This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm) | |
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile | |
source .bash_profile | |
type rvm | head -1 | |
# this command should say 'rvm is a function' | |
rvm install 1.9.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-preview3.tar.gz | |
tar -xvf ruby-1.9.2-preview3.tar.gz | |
cd ruby-1.9.2-preview3 | |
./configure | |
make | |
sudo make install | |
ruby -v #just checking to make sure it installed.. output = ruby 1.9.2dev (2010-05-31 revision 28117) [x86_64-linux] | |
cd .. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm | |
sudo yum -y install gcc gcc-c++ make zlib zlib-devel openssl openssl-devel git expect pcre pcre-devel readline-devel mysql mysql-devel libxml2 libxml2-devel libxslt libxslt-devel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
useradd app_user | |
passwd app_user | |
vi /etc/sudoers #open sudoers in your favorite text edit | |
# add the following line below "root ALL=(ALL) ALL" : | |
# app_user ALL=(ALL) ALL | |
# save file and exit | |
#disable root login from ssh, so nobody is able to brute force a root login | |
vi /etc/ssh/sshd_config | |
#uncomment "PermitRootLogin yes" and change it to "PermitRootLogin no" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def round_to_fraction(number,fraction = 0.5) | |
multiplier = 1.0 / fraction | |
(multiplier*number).round / multiplier | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :app_tasks do | |
desc "create initial paper_trail version for existing records" | |
task(:create_paper_trail_versions => :environment) do | |
#MONKEY PATCH | |
module PaperTrail | |
module Model | |
module InstanceMethods | |
def create_initial_pt_version | |
record_create if versions.blank? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WidgetsController < ApplicationController | |
caches_action :show, :if => Proc.new { |x| x.cacheable? } | |
def show | |
#... | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% private_cache("my_private_cache") do %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
def private_cache (name = {}, &block) | |
if @user.blank? | |
yield and return #note.. I had to add this return..otherwise it rendered twice | |
else | |
cache(name, &block) | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expire_fragment(:controller=>"widget",:action=>"index", :action_prefix=>"some_prefix") | |
expire_fragment("some_name") |
NewerOlder