( Source: the mongoid cheatsheet )
class User
include Mongoid::Document
| #!/usr/bin/env ruby -I ../lib -I lib | |
| # coding: utf-8 | |
| require 'rtoken' | |
| require 'json' | |
| require 'sinatra/base' | |
| require 'thin' | |
| class Chat < Sinatra::Base |
| #!/usr/bin/env ruby | |
| recipe_path = ARGV[0] | |
| if recipe_path.nil? | |
| STDERR.puts "usage: chef-apply RECIPE_FILE" | |
| exit 1 | |
| end | |
| recipe_path = File.expand_path(recipe_path) |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| #!/usr/bin/env dtrace -s | |
| /* | |
| * DTrace script to observe UNIX socket reads/writes for RubyMotion apps running | |
| * in the iOS Simulator. | |
| * | |
| * Usage: sudo dtrace_rubymotion_repl <pid of running RubyMotion iOS app> | |
| * | |
| */ | |
| syscall::sendto:entry |
( Source: the mongoid cheatsheet )
class User
include Mongoid::Document