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
>> u = User.first | |
=> … | |
>> p = u.projects.first | |
=> … | |
>> p.name # Read from embedded doc | |
=> "MongoMapper" | |
>> p.description | |
=> "A Ruby Object Mapper for Mongo" # loads lazy attribute |
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
>> user = User..first | |
=> … | |
>> user.collaborators_loaded? | |
=> false | |
>> user.collaborators.size # <= loads all lazy fields | |
=> 30 | |
>> user.collaborators_loaded? | |
=> true | |
>> user.time_zone_loaded? | |
=> 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
trap :CLD do | |
puts "Reaped #{Process.wait}" | |
end | |
loop do | |
pid = fork { sleep 2 } | |
puts "Spawned #{pid}" | |
sleep 1 | |
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
GC.copy_on_write_friendly = true if GC.respond_to?(:copy_on_write_friendly=) | |
Benchmark.bm(10) do |x| | |
x.report do | |
100.times do | |
100.times { fork {} } | |
Process.waitall | |
end | |
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
require 'selenium-webdriver' | |
class Capybara::Driver::Selenium < Capybara::Driver::Base | |
def self.driver | |
unless @driver | |
@driver = Selenium::WebDriver.for :chrome | |
at_exit do | |
@driver.quit | |
end | |
end | |
@driver |
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
#!/bin/sh | |
mate `bundle show $1` |
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 :install_as_rails_2_3 do | |
sudo "gem install activesupport --version=2.3.8 --no-rdoc --no-ri" | |
end | |
before 'ruby:install_moonshine_deps', 'install_as_rails_2_3' |
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
=ERROR REPORT==== 25-Aug-2010::18:59:16 === | |
** State machine <0.1857.0> terminating | |
** Last event in was {riak_vnode_req_v1, | |
1205132270528594874568590215453917455783181680640, | |
{fsm,undefined,<9962.5024.0>}, | |
{riak_kv_get_req_v1, | |
{<<"moves">>,<<"9273">>}, | |
111118152}} | |
** When State == active | |
** Data == {state,1205132270528594874568590215453917455783181680640, |
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
$('input[type=submit], button').live('click', function() { | |
$('<input type="hidden" class="button" />') | |
.attr({name:this.name, value:this.value || this.innerHTML}) | |
.appendTo(this.form); | |
}); | |
$('form').live('reset', function() { | |
$(this).find('input[type=hidden].button').remove(); | |
}); |
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
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. | |
# It is recommended to regenerate this file in the future when you upgrade to a | |
# newer version of cucumber-rails. Consider adding your own code to a new file | |
# instead of editing this one. Cucumber will automatically load all features/**/*.rb | |
# files. | |
require 'uri' | |
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) |