This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'haml' | |
class Something | |
def self.all( h= {} ) | |
[] | |
end | |
def self.get( id=1 ) | |
obj = Object.new | |
class << obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'optparse' | |
require 'pathname' | |
require 'psych' | |
options = {} | |
optparse = OptionParser.new do |opts| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
count = 1_000_000 | |
Benchmark.bmbm do |bm| | |
bm.report("to_s + ") { count.times { 11.to_s + '/' + 12.to_s } } | |
bm.report("+ ") { count.times { "11" + '/' + "12" } } | |
bm.report('#{} to_s ') { count.times { "#{11}/#{12}" } } | |
bm.report('#{} ') { count.times { %Q!#{"11"}/#{"12"}! } } | |
bm.report("to_s << ") { count.times { 11.to_s << "/" << 12.to_s } } | |
bm.report("<< ") { count.times { "11" << "/" << "12" } } |