Skip to content

Instantly share code, notes, and snippets.

@unnitallman
unnitallman / gist:1307331
Created October 23, 2011 12:52
How to get a method's name from within that method
def test_method
puts __method__
end
@unnitallman
unnitallman / gist:1369872
Created November 16, 2011 11:25
Installing mysql gem on osx
http://wonko.com/post/how-to-install-the-mysqlruby-gem-on-mac-os-x-leopard
@unnitallman
unnitallman / gist:1369873
Created November 16, 2011 11:25
Installing rmagick on osx
http://hocuspokus.net/2010/03/installing-rmagick-on-snow-leopard-leopard/
@unnitallman
unnitallman / gist:1559413
Created January 4, 2012 10:07
Phusion passenger + rvm + different ruby version
rvm use 1.9.1
gem install passenger
cd /var/rails/staging_sites/Zed
passenger start -a 127.0.0.1 -p 3000 -d
<VirtualHost *:80>
ServerName staging.zed.bangthetable.com
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
</VirtualHost>
@unnitallman
unnitallman / gist:1930135
Created February 28, 2012 06:16
Adding bunder-stubs to a project
rvm get head && rvm reload
chmod +x $rvm_path/hooks/after_cd_bundler
cd /path/to/project
bundle install --binstubs=./bundler_stubs
Customer.stub(:find).with(:all) { data_array }
@unnitallman
unnitallman / gist:2426598
Created April 20, 2012 06:30
Custom html in link text using link_to
=link_to "http://google.co.in" do
Hello
<i class="icon-search icon-white">Unni</i>
<b> World </b>
@unnitallman
unnitallman / gist:2692072
Created May 14, 2012 06:03
Custom time formats
#config/initializers/conversions.rb
Time::Conversions::DATE_FORMATS.update(:event => '%I:%M%p')
Time.now.to_s(:event) #=> "03:23PM"
@unnitallman
unnitallman / gist:2692255
Created May 14, 2012 06:41
mysql - home brew - my.cnf
sudo cp $(brew --prefix mysql)/support-files/my-small.cnf /etc/my.cnf
@unnitallman
unnitallman / gist:3910618
Created October 18, 2012 09:16
Running Pow in production environment
echo export RAILS_ENV=production > .powenv && touch tmp/restart.txt