s = Test.new(:name => "foo")
# ActiveRecord::Test after_initialize
# ActiveRecord::Test after_initialize, :on => :update
# ActiveRecord::Test after_initialize, :on => :create
# ActiveRecord::TestObserver after_initialize
# ===> #<Test id: nil, name: "foo", created_at: nil, updated_at: nil>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Ruby script to automatically "git rm" deleted files | |
DELETED_REXP = /^#\s+deleted:\s+(.*)/ | |
MARKER_LINE = '# Changed but not updated:' | |
lines = `git status` | |
found_marker = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'benchmark' | |
require 'date' | |
Benchmark.bm do|b| | |
ITERATE = 100000 | |
b.report("strptime") do | |
time = "2011-05-25 00:00:03 -0400" | |
fmt = "%Y-%m-%d %H:%M:%S %z" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= httperf --server localhost --port 3000 --uri /render_text --num-conns 500 --num-calls 20 | |
== Ruby 1.9.2/WEBrick | |
Request rate: 329.5 req/s (3.0 ms/req) | |
Request rate: 334.6 req/s (3.0 ms/req) | |
== Ruby 1.9.2/Passenger | |
Request rate: 539.5 req/s (1.9 ms/req) | |
Request rate: 543.1 req/s (1.8 ms/req) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :copy_jquery_files do | |
# Jasmine doesn't work with the asset pipeline; therefore we copy the jquery | |
# files manually. | |
spec = Gem::Specification.find_by_name("jquery-rails") | |
jquery_dir = Pathname.new(Gem.dir) + | |
"gems" + | |
"#{spec.name}-#{spec.version}" + | |
"vendor" + | |
"assets" + | |
"javascripts" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew install bash-completion | |
==> Downloading http://bash-completion.alioth.debian.org/files/bash-completion-1.3.tar.bz2 | |
######################################################################## 100.0% | |
==> ./configure --prefix=/usr/local/Cellar/bash-completion/1.3 | |
==> make install | |
==> Caveats | |
Add the following lines to your ~/.bash_profile file: | |
if [ -f `brew --prefix`/etc/bash_completion ]; then | |
. `brew --prefix`/etc/bash_completion | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it "does not have to auto-follow redirects", :driver => :tito_driver do | |
page.driver.stop_following_redirects | |
# make a web request that redirects | |
# do whatever you need to do | |
# the continue... | |
page.driver.follow_redirects! | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'rvm' | |
require 'trollop' | |
opts = Trollop::options do | |
opt :ruby, "ruby interp to use", :type => :string, :required => true | |
opt :gem_name, "gem", :type => :string, :required => true | |
opt :gem_version, "gem", :type => :string, :required => true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h = { | |
hoge: <<EOS, | |
Hey! | |
EOS | |
fuga: <<EOS | |
Yo! | |
EOS | |
} | |
p h |
OlderNewer