Skip to content

Instantly share code, notes, and snippets.

@cnruby
cnruby / include-vs-cover-vs-between.rb
Created November 13, 2012 12:06 — forked from julian7/include-vs-cover-vs-between.rb
include? vs. cover? vs. between?
require 'date'
require 'benchmark'
n = 1_000_000
start_date = Date.new(2012, 01, 01)
end_date = Date.new(2012, 03, 01)
act_date = Date.new(2012, 02, 01)
Benchmark.bm(10) do |x|
x.report('include?') do
@cnruby
cnruby / counter.rb
Created June 3, 2012 20:31 — forked from ppolischuk/counter.rb
Calculate the percentage of tweets linking to a website that came from the Tweet button
# Fork from https://gist.github.com/2864135
#
# Before running:
# $ gem install twitter
#
# To run:
# $ ruby counter.rb plosone.org
#
# Context: