Skip to content

Instantly share code, notes, and snippets.

@jgagner
Created August 11, 2010 21:51
Show Gist options
  • Select an option

  • Save jgagner/519840 to your computer and use it in GitHub Desktop.

Select an option

Save jgagner/519840 to your computer and use it in GitHub Desktop.

Revisions

  1. jgagner revised this gist Aug 11, 2010. 1 changed file with 3 additions and 4 deletions.
    7 changes: 3 additions & 4 deletions rofl.rb
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,5 @@

    def four_times &block
    (1..4).zip([:a,:b,:c,:d]).zip(["face1","face2","face3","face4"]).transpose[0].transpose[0].each(&block)
    def do_something &block
    (1..4).zip([:a,:b,:c,:d]).zip((["face"] * 4).map {|x| x.to_sym}).transpose[0].transpose[0].each(&block)
    end

    four_times { puts "face!"}
    do_something { puts "face!"}
  2. jgagner created this gist Aug 11, 2010.
    6 changes: 6 additions & 0 deletions rofl.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@

    def four_times &block
    (1..4).zip([:a,:b,:c,:d]).zip(["face1","face2","face3","face4"]).transpose[0].transpose[0].each(&block)
    end

    four_times { puts "face!"}