Skip to content

Instantly share code, notes, and snippets.

View yb66's full-sized avatar
🤔
Wondering if Github is going to become a fully fledged social network

Iain Barnett yb66

🤔
Wondering if Github is going to become a fully fledged social network
View GitHub Profile
@yb66
yb66 / bench_str_building.rb
Last active March 20, 2019 05:06 — forked from alno/bench_str_building.rb
Benchmark: interpolation vs concatenation in Ruby
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" } }
#!/usr/bin/env ruby
require 'optparse'
require 'pathname'
require 'psych'
options = {}
optparse = OptionParser.new do |opts|
@yb66
yb66 / app.rb
Created January 21, 2013 12:40 — forked from Heliosmaster/app.rb
require 'sinatra'
require 'haml'
class Something
def self.all( h= {} )
[]
end
def self.get( id=1 )
obj = Object.new
class << obj