Skip to content

Instantly share code, notes, and snippets.

View dgiunta's full-sized avatar

Dave Giunta dgiunta

View GitHub Profile
@dgiunta
dgiunta / git-track
Created January 26, 2010 22:53 — forked from sstephenson/git-track
git-track
#!/bin/sh
branch=$(git branch 2>/dev/null | grep ^\*)
[ x$1 != x ] && tracking=$1 || tracking=${branch/* /}
git config branch.$tracking.remote origin
git config branch.$tracking.merge refs/heads/$tracking
echo "tracking origin/$tracking"
# Factory girl, relaxed.
#
# Factory.define :user do |f|
# f.login 'johndoe%d' # Sequence.
# f.email '%{login}@example.com' # Interpolate.
# f.password f.password_confirmation('foobar') # Chain.
# end
#
# Factory.define :post do |f|
# f.user { Factory :user } # Blocks, if you must.
// only outputs if console available and does each argument on its own line
function log() {
if (window && window.console && window.console.log) {
var i, len;
for (i=0, len=arguments.length; i<len; i++) {
console.log(arguments[i]);
}
}
}
@dgiunta
dgiunta / gist:67600
Created February 20, 2009 17:58 — forked from jkestr/gist:67593
def generate_attribute_list(only, except)
result = self.new.attribute_names
result &= [only].flatten unless only.blank?
result -= [except].flatten unless except.blank?
return result
end