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
for i in app/models/*.rb ; do sed "s/\s\+def \(self\.\)\?\([^( ]*\).*\|\s\+scope :\([^,]*\).*/\2\3/;tx;d;:x" $i | while read j ; do echo $(grep -R $j app/ lib/ config/ | wc -l) $j ; done ; done | sort -rn |
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 Taco | |
> def self.delicious? ; true ; end | |
> singleton_class.send :alias_method, :yummy?, :delicious? | |
> end | |
=> #<Class:Taco> | |
> Taco.yummy? | |
=> 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
pete@balloon:~/projects/nand2tetris/phiggins/01$ pwd | |
/home/pete/projects/nand2tetris/phiggins/01 | |
pete@balloon:~/projects/nand2tetris/phiggins/01$ ../../tools/HardwareSimulator.sh ~/projects/nand2tetris/phiggins/01/Mux4Way16.tst | |
End of script - Comparison ended successfully | |
pete@balloon:~/projects/nand2tetris/phiggins/01$ |
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 'spec_helper' | |
describe User do | |
it "should blow up" do | |
expect(User).to receive(:create!).and_raise(ActiveRecord::RecordNotUnique) | |
end | |
end | |
=begin | |
Fails with: |
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
Failure/Error: expect(View).to receive(:create!).and_raise(ActiveRecord::RecordNotUnique) | |
ArgumentError: | |
wrong number of arguments (0 for 2) |
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 Kernel | |
def method_a | |
:foo | |
end | |
end | |
def method_b | |
:bar | |
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
module Kernel | |
def required(arg=nil) | |
method = caller_locations(1,1)[0].label | |
raise ArgumentError.new("required parameter #{arg.to_sym.inspect + ' ' if arg}not passed to method #{method}") | |
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 'net/http' | |
require 'json' | |
require 'uri' | |
require 'pp' | |
uri = URI(ARGV[0]) | |
pp JSON.parse(Net::HTTP.get_response(uri).body) |
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 'active_record' | |
require 'sqlite3' | |
require 'minitest/autorun' | |
puts "ActiveRecord: #{ActiveRecord::VERSION::STRING}" | |
ActiveRecord::Base.establish_connection( | |
:adapter => "sqlite3", | |
:database => ":memory:" | |
) |
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
[11:30:26 rdoc (master u=)]$ gem list | |
*** LOCAL GEMS *** | |
bundler (1.3.5, 1.1.5, 1.1.3) | |
hoe (3.5.3) | |
rake (10.0.4, 0.9.2.2) | |
rubygems-bundler (1.1.1, 1.0.7, 1.0.1, 1.0.0) | |
rvm (1.11.3.5) | |
[11:30:29 rdoc (master u=)]$ rake newb |