News for hackers. Stuff that matters.
Re:Dropbox dives into CoffeeScript by alinajaf on Thursday September 13, 2012 @05:27PM (#4518719)
Just another datapoint, but contrary to the other comments here I find your reduce example a lot more readable than the original. This could be because it's fairly idiomatic ruby.
Re:Dropbox dives into CoffeeScript by byroot on Thursday September 13, 2012 @09:12PM (#4519535)
For me this in idiomatic ruby would be:

  original_style = element.style.only('top', 'left', 'width', 'height')
Or if you do not want to rely on ActiveSupport:

  original_style = Hash[%w(top left width height).map{ |p| [p, element.style[p]] }]
Re:Dropbox dives into CoffeeScript by alinajaf on Friday September 14, 2012 @02:21AM (#4520336)
Without ActiveSupport I'd probably type something like this:

  %w(top left width height).reduce({}) { |memo, pos| memo[position] = @element.style[position] and memo }