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
本拠> rake rspec:pre_commit ~/code/rspec-dev/example_rails_app | |
(in /Users/wilson/code/rspec-dev/example_rails_app) | |
running against rails 2.2.2 | |
##################################################### | |
running pre_commit against rails 2.2.2 | |
##################################################### | |
HEAD is now at ff56137... Doc updates | |
##################################################### | |
rm -rf db/*.db | |
##################################################### |
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
# Original code by Robert Klemme | |
OUT=open("objects.log","w") | |
OUT.sync = true | |
$last_stat = nil | |
$run_count = 0 | |
OUT.puts "run,classname,last,count,delta" | |
class ObjectTrackFilter < Mongrel::HttpHandler | |
def process(request,response) |
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
words = %w(one two three lol zarglezargle one two six jambo) | |
p words.select {|word| word if (word.length > 3)..(word.length > 5) } | |
# output: | |
# ["three", "lol", "zarglezargle", "jambo"] | |
# 'one' and 'two' are skipped because they are not > 3 characters in length | |
# 'three' triggers the left side of the flip-flop condition | |
# 'lol' is selected because the left side has triggered, but not the right side | |
# 'zarglezargle' triggers the right side condition, and 'turns off' the flip-flop | |
# Because we used '..' here instead of '...' in the flip-flop, the condition returns true |
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
# > {:x => 4, :y => 7}.keys_sorted_by_value | |
# [:y, :x] | |
class Hash | |
def keys_sorted_by_value | |
to_a.sort_by {|tuple| rand - tuple.last.to_i}.map {|tuple| tuple.first} | |
end | |
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
(gdb) r | |
Starting program: /Users/wilson/code/rbx/bin/rbx -P stuff.rb | |
Reading symbols for shared libraries +++. done | |
Reading symbols for shared libraries ... done | |
Reading symbols for shared libraries . done | |
Catchpoint 1 (exception thrown). | |
Catchpoint 1 (exception caught), throw location vm/exception.cpp:25, catch location unknown, exception type rubinius::TypeError | |
0x00007fff85953b9d in __cxa_throw () | |
(gdb) bt |
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
data = {} | |
choices = ('a'..'z').to_a | |
100_000.times do |i| | |
data[i] = choices[rand(26)] | |
end | |
data.sort_by {|k,v| k} |
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
obj = "something" | |
method_name = "foo" | |
obj.instance_eval <<-CODE | |
def #{method_name} | |
"blah" | |
end | |
CODE | |
# ... or.. |
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
<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-08-15/"> | |
<reservationSet> | |
<item> | |
<reservationId>r-44a5402d</reservationId> | |
<ownerId>UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM</ownerId> | |
<groupSet> | |
<item> | |
<groupId>default</groupId> | |
</item> | |
</groupSet> |
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
--- | |
gem: --no-ri --no-rdoc | |
:benchmark: false | |
:backtrace: true | |
:update_sources: true | |
:verbose: really | |
:sources: | |
- http://gemcutter.org | |
- http://gems.rubyforge.org | |
- http://gems.github.com |
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
# Run the bundler directly instead of relying on Rake to do it | |
if ARGV.any? {|task_name| task_name =~ /^gems:bundle$/} | |
system "gem bundle" | |
end | |
require(File.join(File.dirname(__FILE__), 'config', 'boot')) | |
require 'rake' | |
require 'rake/testtask' | |
require 'rake/rdoctask' |