M.map(&:first)

Ruby On Array parsing in a block

by Alec Leitner, January 26, 2012 08:30
72820eaf703cd07ba9bc6ecc09e5d81a Talk
def is_example_row?
  scenario.class == Cucumber::Ast::OutlineTable::ExampleRow
end
...

Ruby On unless.. if..

by Alec Leitner, September 26, 2011 12:49

forget the leftover "end", ...

72820eaf703cd07ba9bc6ecc09e5d81a Talk
def is_example_row?
  scenario.class == Cucumber::Ast::OutlineTable::ExampleRow
end
...

Ruby On unless.. if..

by Alec Leitner, September 26, 2011 12:46

or this here. but you shoul...

72820eaf703cd07ba9bc6ecc09e5d81a Talk
def steps
  @steps ||= begin
    if scenario.class == Cucumber::Ast::OutlineTable::ExampleRow
...

Ruby On unless.. if..

by Alec Leitner, September 26, 2011 10:31

a bit more compact.

72820eaf703cd07ba9bc6ecc09e5d81a Talk
Hash["1","a","2","b"]
 => {"1"=>"a", "2"=>"b"} 

...

Ruby On Alternating Array to a Hash

by Alec Leitner, May 04, 2011 15:51

Jules, why so complicated?

72820eaf703cd07ba9bc6ecc09e5d81a Talk
Hash[*stuff]

Ruby On Alternating Array to a Hash

by Alec Leitner, May 03, 2011 07:58
72820eaf703cd07ba9bc6ecc09e5d81a Talk

Ruby On loop a random generator unt...

by Alec Leitner, August 15, 2009 23:36

Frahugo, that's a neat tric...

72820eaf703cd07ba9bc6ecc09e5d81a Talk

Ruby On loop a random generator unt...

by Alec Leitner, August 11, 2009 06:33

Joel, in my case that's not...

72820eaf703cd07ba9bc6ecc09e5d81a Talk
def create_something(min_value)
  loop do
    something = SomeClass.generate_random
...

Ruby loop a random generator unt...

by Alec Leitner, August 10, 2009 20:36, 5 refactorings, tagged with ruby, loop

This is my version of loopi...

72820eaf703cd07ba9bc6ecc09e5d81a Talk
details.map{|x| x[:subtotal]}

Ruby On Extract specific keys from ...

by Alec Leitner, August 04, 2009 02:16

is this what you want?

72820eaf703cd07ba9bc6ecc09e5d81a Talk
class Array
  def compress
    sorted = compact.uniq.sort
...

Ruby On compressing an array of int...

by Alec Leitner, April 15, 2009 23:52

and here's the non-destruct...

72820eaf703cd07ba9bc6ecc09e5d81a Talk
class Array
  def compress!
    compact!
...

Ruby On compressing an array of int...

by Alec Leitner, April 15, 2009 23:36

cleaned it up a bit... any ...

72820eaf703cd07ba9bc6ecc09e5d81a Talk
class Array
  def compress!
    compact!
...

Ruby On compressing an array of int...

by Alec Leitner, April 15, 2009 23:31

found a shorter solution, s...

72820eaf703cd07ba9bc6ecc09e5d81a Talk

Haskell On compressing an array of int...

by Alec Leitner, April 15, 2009 18:37

Oh, I might have to learn H...

72820eaf703cd07ba9bc6ecc09e5d81a Talk
class Array
  # does a kind of ZIP compression for integer arrays
  # examples:
...

Ruby compressing an array of int...

by Alec Leitner, April 14, 2009 20:49, 4 refactorings, tagged with ruby, array, compression

I've written a small method...

72820eaf703cd07ba9bc6ecc09e5d81a Talk