Skip to content

Instantly share code, notes, and snippets.

@jacegu
jacegu / typoeus_vs_em.rb
Created August 17, 2012 07:06
Some Benchmarks
require 'em-http-request' #gem install em-http-request
require 'typhoeus' #gem install typhoeus
ENDPOINT = 'https://api.github.com/repos/rails/rails/issues'
ISSUE_PAGES = 6
def benchmark(message, &code)
start_time = Time.now
code.call
end_time = Time.now
@madrobby
madrobby / i18n.coffee
Created November 14, 2011 15:45
Backbone i18n with CoffeeScript
# before this file is loaded, a locale should be set:
#
# In a browser environment, you can use:
# ```<script>__locale='en';</script>```
#
# In a server environment (specifically node.js):
# ```global.__locale = 'en';```
# normalize in-app locale string to "en" or "de-AT"
parts = @__locale.split('-')