Skip to content

Instantly share code, notes, and snippets.

View jackbit's full-sized avatar

Yacobus Reinhart jackbit

View GitHub Profile
@jackbit
jackbit / gist:3347643
Created August 14, 2012 08:55 — forked from mperham/gist:1379464
Flexibility without Dependency Injection
class TaxCode
GENERATORS = {
:us => lambda { |id| "US-#{id}" },
:br => lambda { |id| "#{id + 9}-BRA" },
}
def self.generate(code, id)
gen = GENERATORS[code] || raise ArgumentError, "No generator for country #{code}"
gen.call(id)
end
@jackbit
jackbit / mongoid-cheatsheet.md
Created April 15, 2012 15:06 — forked from icebreaker/mongoid-cheatsheet.md
Mongoid cheat sheet
@jackbit
jackbit / em-stream-tail.rb
Created February 29, 2012 01:48 — forked from zpoley/em-stream-tail.rb
Simple stream tail -f over http socket using Ruby EventMachine
#!/usr/bin/env ruby
#
# README: Start server with em-stream-tail.rb tail-filename
# Connect to server with curl http://localhost:8083
# Observe log events on curl.
#
require 'rubygems'
require 'eventmachine'
if ARGV.empty?