Skip to content
Björn Skarner edited this page May 31, 2013 · 19 revisions

30/5 Meeting notes

Olle - ActiveRecord/Enumerable/Hash trix

def followed_keyphrases_dict
  Hash[ self.books
    .joins(:words)  # ActiveRecord: INNER JOIN
    .uniq           # ActiveRecord: DISTINCT
    .select('words.id AS id, words.text AS keyphrase') # ActiveRecord: Reduce data fetching
    .group_by {|fetched_sql_data| fetched_sql_data.keyphrase }  # Enumerable: Key by the aliased keyphrase field
    .collect {|keyword, item| [keyword, item[0].id]  } # Enumerable: Create list of pairs
  ] # Hash: Return as hash from the list of pairs
end

Joel - Gems Gems Gems

Help your command line application with:

  • options parsing
  • arguments parsing
  • configuration files
  • environment variables
  • --help generation
commander init simple-app.rb

Record your test HTTP request and replay the during future tests, fast test!

http://relishapp.com/vcr/vcr

Lasse - rspec-hue

Felix - Queue

Use Queue to keep synchronous interface while performing work in parallel (gist)

Björn - NullObjectPattern

Andreas - Hypermedia API javascript client

How to avoid traffic to your website:

  • HyperMedia and Linked Cache Invalidation
  • One year browser caching of all resources except root resource
  • Root resource contains URL links with a version
  • When a resource changes the version changes, and the root resource will be updated - Linked Cache Invalidation