Skip to content

Instantly share code, notes, and snippets.

View emilebosch's full-sized avatar
🏠
Working from home

Emile emilebosch

🏠
Working from home
  • Lisbon
  • 17:41 (UTC +02:00)
View GitHub Profile
@anolson
anolson / model.rb
Created December 21, 2010 20:02
ActiveRecord like model with validations and dynamic attributes
require 'rubygems'
require 'active_model'
require 'active_support'
class Model
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
def initialize(attributes = {})
@aishfenton
aishfenton / serializer_benchmarks.rb
Created July 18, 2010 02:32 — forked from visfleet/performance_of_yaml_vs_marshal.rb
Performance comparison of different ruby serializer methods
# sudo gem install bson
# sudo gem install bson_ext
# sudo gem install yajl-ruby
# sudo gem install json
# sudo gem install msgpack
require 'rubygems'
require 'benchmark'
require 'yaml'
require 'bson'
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby