Skip to content

Instantly share code, notes, and snippets.

View warrenseen's full-sized avatar

Warren Seen warrenseen

View GitHub Profile
#!/bin/sh
CHANGES=$(bundle exec rubocop -a -f fi)
if [ -n "${CHANGES//\n}" ]; then
git add -p $CHANGES < /dev/tty
fi
# If you're just using devise, it should have already loaded the current user for you
@user = current_user
@product = @user.products.build.tap do |product|
product.product_countries.build
product.product_people.build.build_person
end
@warrenseen
warrenseen / database.yml
Created April 29, 2011 01:41
Different DBs depending on git branch
<%
# Adds the current GIT repo to the database name.
parts = [ `git symbolic-ref HEAD 2>/dev/null`.chomp.sub('refs/heads/', ''), ENV['TEST_ENV'] ].compact
suffix = parts.length == 0 ? "" : "_#{parts.join("_")}"
%>
development:
adapter: postgresql
encoding: unicode
pool: 5