-
Notifications
You must be signed in to change notification settings - Fork 0
20130530
Björn Skarner edited this page May 31, 2013
·
19 revisions
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
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!
- PhraseApp, https://phraseapp.com/
- Phrase examples/gems, https://github.com/phrase
- Connecting rspec to Philips Hue, found at Apple Store, with rspec-hue
- An alternative to PhraseApp, LocaleApp
Use Queue to keep synchronous interface while performing work in parallel (gist)
- [Null Object Pattern - Wikipedia] (http://en.wikipedia.org/wiki/Null_Object_pattern)
- [Naught by Avdi Grimm] (https://github.com/avdi/naught)
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