Skip to content

Instantly share code, notes, and snippets.

@stanislaw
Forked from gilgen/handystuff.md
Created September 19, 2011 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stanislaw/1227643 to your computer and use it in GitHub Desktop.
Save stanislaw/1227643 to your computer and use it in GitHub Desktop.
Handy stuff

Jamie's handy tidbits

Convert all .erb files in a directory to haml and delete the .erb files

find . -name '*erb' | xargs ruby -e 'ARGV.each { |i| puts "html2haml -r #{i} #{i.sub(/erb$/,"haml")};rm #{i}"}' | bash

Setup postgres http://shifteleven.com/articles/2008/03/21/installing-postgresql-on-leopard-using-macports

Add a postgres user

sudo -u postgres createuser -S -D -R -P your_user_name

Create a postgres database owned by a user

sudo -u postgres createdb -O database_owner_username name_of_database

Crazy omniauth segfault workaround/fix(?)

export RUBYOPT='-r openssl'

Scaffold with only needed stuff

rails g scaffold <model> <attributes> -e haml --routing-specs=false --helper-specs=false --controller-specs=false --fixture=false --view-specs=false --model-spec=false --helper=false --stylesheets=false -p

Use url helpers from the console

include ActionController::UrlWriter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment