Skip to content

Instantly share code, notes, and snippets.

[branch "master"]
remote = origin
merge = refs/heads/master
function gc {
if [ -z "$1" ]; then
git checkout master
else
git checkout $1
fi
}
task :fix_updated_at => :environment do
desc 'fix updated_at dates on requests'
Request.record_timestamps = false
Request.all.each do |r|
r.update_attribute(:updated_at, r.calculated_updated_at)
end
end
gem 'ruby_parser'
gem 'hpricot'
gem 'haml'
class AddFieldToUser < ActiveRecord::Migration
def self.up
ActiveRecord::Base.establish_connection "user_#{Rails.env}"
add_column :users, :field, :type
end
...
end
namespace :myapp do
task :reset_passwords => :environment do
desc 'set all passwords to Test1234 to login locally'
exit(1) unless Rails.env.development?
User.all.each do |user|
user.password = user.password_confirmation = "Test1234"
user.save
end
end
end
@wesgarrison
wesgarrison / spec_helper.rb
Created March 14, 2011 14:49
spec_helper.rb
# From http://opinionated-programmer.com/2011/02/profiling-spork-for-faster-start-up-time/
Spork.prefork do
# ... your normal prefork block goes here ...
module Kernel
def require_with_trace(*args)
start = Time.now.to_f
@indent ||= 0
@wesgarrison
wesgarrison / .toprc
Created September 1, 2011 15:30
unix top() settings file
RCfile for "top with windows" # shameless braggin'
Id:a, Mode_altscr=0, Mode_irixps=1, Delay_time=3.000, Curwin=0
Def fieldscur=AEHIOQTWKNMbcdfgjplrsuvyzX
winflags=64440, sortindx=10, maxtasks=0
summclr=1, msgsclr=1, headclr=3, taskclr=1
Job fieldscur=ABcefgjlrstuvyzMKNHIWOPQDX
winflags=62777, sortindx=0, maxtasks=0
summclr=6, msgsclr=6, headclr=7, taskclr=6
Mem fieldscur=ANOPQRSTUVbcdefgjlmyzWHIKX
winflags=62777, sortindx=13, maxtasks=0
@wesgarrison
wesgarrison / .bash_profile
Created September 8, 2011 15:28
bash setup
LSCOLORS='gxfxcxdxbxegedabagacad'
export LSCOLORS
alias ls='ls -hGF' # --color=auto not valid on OS X
alias ll='ls -alhGF' # --color=auto not valid on OS X
alias flushdns='dscacheutil -flushcache'
# git
$$('tbody .btn-disabled')
.each(function(element, index) {
element.up('tbody').hide()
});