This file contains hidden or 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
module Rails | |
module Initializable | |
# A collection of initializers | |
class Collection | |
def initialize(context) | |
@context = context | |
@keys = [] | |
@values = {} | |
@ran = false |
This file contains hidden or 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
class Rails::Application | |
initializer :require_frameworks do | |
require "action_pack" | |
end | |
end | |
class Rails::Application::Sinatra | |
initializer :load_in_file_templates do | |
# Go through app code files and check for templates | |
end |
This file contains hidden or 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
clear_sources | |
bundle_path "vendor/bundler_gems" | |
bin_path "vendor/bin" | |
source "http://gemcutter.org" | |
source "http://gems.github.com" | |
gem "rails", "2.3.4", :only => :bundle | |
gem "clearance" | |
gem "will_paginate" |
This file contains hidden or 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
class User | |
include DataMapper::Resource | |
def w0t | |
User.create | |
end | |
end | |
u1 = nil | |
u2 = nil |
This file contains hidden or 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
# heredocs can continue the code on the same line: | |
class SomeController | |
def render opts | |
p opts | |
end | |
def setup; false; end | |
def action_a | |
### |
This file contains hidden or 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
class Foo | |
def initialize | |
self.im_private # FAIL | |
end | |
private | |
def im_private | |
puts "PRIVATE" | |
end | |
end |
This file contains hidden or 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 "rubygems" | |
require "rbench" | |
def omg_slow | |
return 1 | |
end | |
def omg_fast | |
1 | |
end |
This file contains hidden or 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 "benchmark" | |
def do_it | |
i = 0 | |
while i < 10_000_000 | |
Object.allocate | |
Object.new | |
i+=1 | |
end | |
end |
This file contains hidden or 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
def hello | |
my_proc = do |a, b| | |
a + b | |
end | |
my_proc[1, 2] | |
my_proc[2, 4] | |
end |
This file contains hidden or 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 "rubygems" | |
require "spec" | |
module MatcherComposition | |
include Spec::Matchers | |
def +(other_matcher) | |
# Build a new simple matcher that combines self and the other matcher | |
simple_matcher("#{description} and #{other_matcher.description}") do |given, matcher| | |
matcher.negative_failure_message = "" |