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
http://github.com/api/v2/yaml/blob/show/defunkt/facebox/d4fc2d5e810d9b4bc1ce67702603080e3086a4ed |
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
http://github.com/api/v2/plain/blob/show/defunkt/facebox/d4fc2d5e810d9b4bc1ce67702603080e3086a4ed |
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
:command! -nargs=1 Ci !cd %:h && git commit %:t -m <q-args> |
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
$ which ruby | |
/usr/local/bin/ruby | |
runpaint@a1:~/git/mspec$ ruby -S rake spec | |
(in /home/runpaint/git/mspec) | |
/home/runpaint/git/mspec/spec/expectations/should_spec.rb:4:in `<top (required)>': uninitialized constant MSpec (NameError) | |
from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-1.2.6/lib/spec/runner/example_group_runner.rb:15:in `load' | |
from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-1.2.6/lib/spec/runner/example_group_runner.rb:15:in `block in load_files' | |
from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-1.2.6/lib/spec/runner/example_group_runner.rb:14:in `each' | |
from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-1.2.6/lib/spec/runner/example_group_runner.rb:14:in `load_files' | |
from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-1.2.6/lib/spec/runner/options.rb:99:in `run_examples' |
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
runpaint@a1:~/git/mspec$ rake spec | |
/home/runpaint/git/mspec/spec/expectations/should_spec.rb:4:in `<top (required)>': uninitialized constant MSpec (NameError) | |
from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-1.2.6/lib/spec/runner/example_group_runner.rb:15:in `load' | |
from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-1.2.6/lib/spec/runner/example_group_runner.rb:15:in `block in load_files' | |
from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-1.2.6/lib/spec/runner/example_group_runner.rb:14:in `each' | |
from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-1.2.6/lib/spec/runner/example_group_runner.rb:14:in `load_files' | |
from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-1.2.6/lib/spec/runner/options.rb:99:in `run_examples' | |
from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-1.2.6/lib/spec/runner/command_line.rb:9:in `run' | |
from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-1.2.6/bin/spec:4:in `<main>' | |
rake aborted! |
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
$ ruby -v -e 'x={};x[0]=x;p x.to_s' | |
ruby 1.9.1p129 (2009-05-12 revision 23412) [i686-linux] | |
"{0=>{0=>{...}}}" | |
$ ruby -v -e 'x={};x[0]=x;p x.inspect' | |
ruby 1.9.1p129 (2009-05-12 revision 23412) [i686-linux] | |
"{0=>{...}}" | |
$ ruby1.8 -v -e 'x={};x[0]=x;p x.to_s' | |
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux] |
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
hash = {1 => 2, 3 => 4, 5 => 6} | |
big_hash = {} | |
64.times { |k| big_hash[k.to_s] = k } | |
hash.each { hash.merge!(big_hash) } |
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
$ ruby -ve 'h={:f=>:b,:g=>:q}; h.update(h.dup){|k,o,n| h.shift; o}; p h' | |
ruby 1.9.1p129 (2009-05-12 revision 23412) [i686-linux] | |
{:f=>:b, :g=>:q} | |
$ ruby1.8 -ve 'h={:f=>:b,:g=>:q}; h.update(h.dup){|k,o,n| h.shift; o}; p h' | |
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux] | |
{:f=>:b} |
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
While writing some specifications for RubySpec, I've encountered an issue that | |
I'd appreciate clarification on. What is the expected behaviour of an iterator | |
if it is modified inside of the block it yields to? | |
For example, the following enters an infinite loop because it appends to the | |
Array being iterated over for each iteration. Here, the number of iterations | |
can be increased from within the block. | |
>> a = (1..10).to_a | |
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |
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
#!/usr/bin/env ruby | |
methods = Hash.new {|h,obj| h[obj] = obj.instance_methods(nil) } | |
sym = Hash.new {|h, sym| h[sym] = sym.to_s.sub(/[\?\!\=]/,'')}. | |
merge Hash[*%w{= equal [] constructor == equal > gt < lt}] | |
ObjectSpace.each_object(Class) do |obj| | |
path = %w{core library language}. | |
map{ |dir| File.join(dir, obj.to_s.downcase[/^(.+?)(class)?$/,1]) }. |
OlderNewer