Skip to content

Instantly share code, notes, and snippets.

View csquared's full-sized avatar

Chris Continanza csquared

  • ex-stripe, ex-coinbase, ex-heroku
  • Brooklyn, NY
View GitHub Profile
@csquared
csquared / inject_vs_readability.rb
Created December 16, 2011 08:34 — forked from bbwharris/inject_vs_readability.rb
Inject vs. Readability
# inject is cool and elegant. I use it when I want to be cool. However, I tend to robotically begin the procedural
# way and end up at inject when I realize I am in that situation. See this simple example:
include ActionView::Helpers
class Link < Struct.new(:title, :url); end
a = Link.new("Google", "http://www.google.com")
b = Link.new("Hacker News", "http://news.ycombinator.com")
array_of_links = [a, b]