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
class Person < ActiveRecord::Base | |
has_many :friends do | |
def clear | |
raise "Do not use this method" | |
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
class Post | |
extend ActiveModel::Naming | |
include ActiveModel::Validations | |
include ActiveModel::Conversion | |
validates :title, :presence => true | |
def self.find(id) | |
new.tap { |l| l.record = self::Record.find(id) } | |
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
describe Item do | |
describe "total" do | |
before do | |
@item = Item.new | |
@item.stub!(:calculate_total => 123) | |
end | |
it "returns the calculated total" do | |
@item.total.should == 123 | |
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
[2011-07-27 15:47:43] make | |
/usr/bin/gcc-4.2 -isysroot /Developer/SDKs/MacOSX10.7.sdk -arch x86_64 -fno-common -pipe -L. -Wl,-syslibroot /Developer/SDKs/MacOSX10.7.sdk -arch x86_64 -L/usr/local/lib -Wl,-u,_objc_msgSend main.o dmydln.o dmyencoding.o dmyversion.o miniprelude.o array.o bignum.o class.o compar.o complex.o dir.o dln_find.o enum.o enumerator.o error.o eval.o load.o proc.o file.o gc.o hash.o inits.o io.o marshal.o math.o node.o numeric.o object.o pack.o parse.o process.o random.o range.o rational.o re.o regcomp.o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o signal.o sprintf.o st.o strftime.o string.o struct.o time.o transcode.o util.o variable.o compile.o debug.o iseq.o vm.o vm_dump.o thread.o cont.o ascii.o us_ascii.o unicode.o utf_8.o newline.o dmyext.o -lpthread -ldl -lobjc -o miniruby | |
rbconfig.rb updated | |
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ./enc/make_encmake.rb --builtin-encs="ascii.o us_ascii.o unicode.o utf_8.o" --builtin-transes="newline.o" enc |
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
Installing Ruby from source to: /Users/austin_schneider/.rvm/rubies/ruby-1.9.2-p290, this may take a while depending on your cpu(s)... | |
ruby-1.9.2-p290 - #fetching | |
ruby-1.9.2-p290 - #extracted to /Users/austin_schneider/.rvm/src/ruby-1.9.2-p290 (already extracted) | |
Fetching yaml-0.1.4.tar.gz to /Users/austin_schneider/.rvm/archives | |
Extracting yaml-0.1.4.tar.gz to /Users/austin_schneider/.rvm/src | |
Configuring yaml in /Users/austin_schneider/.rvm/src/yaml-0.1.4. | |
Compiling yaml in /Users/austin_schneider/.rvm/src/yaml-0.1.4. | |
Installing yaml to /Users/austin_schneider/.rvm/usr | |
ruby-1.9.2-p290 - #configuring |
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
Installing Ruby from source to: /Users/austin_schneider/.rvm/rubies/ruby-1.9.2-p290, this may take a while depending on your cpu(s)... | |
ruby-1.9.2-p290 - #fetching | |
ruby-1.9.2-p290 - #extracted to /Users/austin_schneider/.rvm/src/ruby-1.9.2-p290 (already extracted) | |
Fetching yaml-0.1.4.tar.gz to /Users/austin_schneider/.rvm/archives | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
100 460k 100 460k 0 0 278k 0 0:00:01 0:00:01 --:--:-- 317k | |
Extracting yaml-0.1.4.tar.gz to /Users/austin_schneider/.rvm/src | |
Configuring yaml in /Users/austin_schneider/.rvm/src/yaml-0.1.4. |
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
{ | |
"recipes": [ | |
"yumrepo::epel", | |
"users", | |
"sudo", | |
"firewall", | |
"heartbeat", | |
"haproxy", | |
"monit", | |
"log-backups", |
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
=== General Commands | |
help # show this usage | |
version # show the gem version | |
list # list your apps | |
create [<name>] # create a new app | |
keys # show your user's public keys | |
keys:add [<path to keyfile>] # add a public key |
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
puts :hi |
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
module MethodBenchmarker | |
def benchmarks(*methods) | |
methods.flatten.each do |method| | |
define_method("#{method}_with_benchmark") do |*args| | |
r = nil | |
secs = Benchmark.realtime { r = send("#{method}_without_benchmark", *args) } | |
puts *[ | |
"\n##################################################", | |
"Method '#{method}' took #{sprintf("%.4f", secs)} seconds", | |
"##################################################" |