Skip to content

Instantly share code, notes, and snippets.

View michel's full-sized avatar

Michel de Graaf michel

View GitHub Profile
@michel
michel / beequip.rb
Created November 2, 2017 11:55
BEEQUIP vacancy
```class Candidate
attr_accessor :ambition, :location, :education, :skills
def initialize person
@ambition = person.ambition
@location = person.location
@education = person.education
@skills = person.skills
end
end
@michel
michel / gist:2169353
Created March 23, 2012 10:26
Quick vim regex to convert hashrocket (=>) 1.8 to colon syntax (:) 1.9:
nmap <leader>rh :%s/\v:(\w+) \=\>/\1:/g<cr>
@michel
michel / hashtable.rb
Created July 15, 2013 21:15
TDD hashtable
require 'rspec'
#http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx
class String
def hashKey
rot_hash
end
@michel
michel / gist:2642915
Created May 9, 2012 08:18
Pow not loading rvm env solution
rvm env . > .powenv
touch tmp/restart.txt
@michel
michel / walrus.rb
Created May 8, 2012 21:43
grow a test suite
class Walrus
attr_reader :energy
def initialize
@energy = 0
end
def receive_gift!(gift)
if gift.edible?
@energy += gift.digest.energy
@michel
michel / gist:2169470
Created March 23, 2012 10:39
LRUCache code kata 2
class LRUCache
def initialize(size = 10)
@size = size
@store = {}
@lru = []
end
def set(key, value)
@store[key] = value
@michel
michel / lru.rb
Created March 23, 2012 10:24
LRU caching code kata
class Cache
attr_accessor :max_size
def initialize
@max_size = 99
@cache = {}
end
def store(key,object)
@cache[key] = [0,object]
purge_old
key
@michel
michel / test.xml
Created March 1, 2012 20:00
ringr
<?xml version="1.0" encoding="UTF-8"?><Response><Play>http://izerion.com/da1392f0-460b-012f-74be-3c07544054a5.wav?asdf</Play></Response>
alias app_setup='br db:drop:all && br db:create:all && br dsi:schema:load && br db:schema:load && br db:seed'
@michel
michel / download_chromium.sh
Created March 17, 2011 10:34
Download and install latest Chromium build on OS X. For a quick install run the following command in your console: curl https://gist.github.com/raw/874137/2f045246310587f5384c9db57e62f049e89ffbc6/download_chromium.sh > download_chromium.sh; chmod +x down
#!/bin/bash
BASEDIR=http://build.chromium.org/f/chromium/snapshots/Mac
mkdir -p /tmp/chromium_nightly
cd /tmp/chromium_nightly
echo "Downloading number of latest revision"
REVNUM=`curl -# $BASEDIR/LATEST`
echo "Found latest revision number $REVNUM, starting download"