Skip to content

Instantly share code, notes, and snippets.

View sirupsen's full-sized avatar
🐡

Simon Eskildsen sirupsen

🐡
View GitHub Profile
@sirupsen
sirupsen / balanced.rb
Last active December 22, 2015 13:48
Benchmarks for a variety of ways to search through an array of strings for a prefix match.
class BBT
def initialize(array)
@set = array.sort
end
def lower_bound(element)
lower, upper = 0, @set.size - 1
while lower != upper
middle = (lower + upper) / 2
@sirupsen
sirupsen / vim7.3_mac_install.rb
Created July 27, 2011 21:57 — forked from pengwynn/vim7.3_mac_install.rb
Script to install Vim 7.3 with ruby support for Mac OS X Lion
# requires root permissions in /usr/bin/
star = String.new
8.times { star += "*" }
Star = "\n#{star * 3}\n"
def newblock string
puts "\n#{Star}#{string}#{Star}\n"
end