Skip to content

Instantly share code, notes, and snippets.

class Iterator < Enumerator
def initialize obj, meth, *args
super() do |y|
loop do
y << obj
obj = obj.send(meth, *args)
end
end
end
end
@cantin
cantin / how_it_works.md
Created December 3, 2012 03:12 — forked from rubiii/how_it_works.md
MacVim-Formatter for RSpec
$ rspec --format MacVimFormatter --color spec
@cantin
cantin / gist:3936965
Created October 23, 2012 05:43 — forked from zernel/gist:3749856
Logger
file = File.join(Rails.root, 'log/markdown.log')
File.new(file, 'w+') unless File.exist?(file)
logger = Logger.new(file)
logger.info("#{Time.now}: Share##{_id}'s price is from #{latest_price} to #{new_price}")
logger.close