Skip to content

Instantly share code, notes, and snippets.

@rubiety
Created July 22, 2009 15:23
Show Gist options
  • Save rubiety/152046 to your computer and use it in GitHub Desktop.
Save rubiety/152046 to your computer and use it in GitHub Desktop.
# Bad:
1.upto(10) do |i|
puts "X" * i
end
# Good:
((nil.object_id - 3)..(2**3 + 2)).map do |i|
lambda { "X" * i }
end.collect {|i| i.send(:call)}.tap do |a|
puts a.class.instance_method(:join).send(:bind, a).call("\n")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment