Skip to content

Instantly share code, notes, and snippets.

Avatar

Michel de Graaf michel

View GitHub Profile
@michel
michel / beequip.rb
Created Nov 2, 2017
BEEQUIP vacancy
View beequip.rb
```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
View keybase.md

Keybase proof

I hereby claim:

  • I am michel on github.
  • I am micheldegraaf (https://keybase.io/micheldegraaf) on keybase.
  • I have a public key whose fingerprint is D49B 05DA 9775 7124 C438 6F14 B676 F887 FCC9 B60E

To claim this, I am signing this object:

@michel
michel / gist:7e2c210b973123220ec8
Created Jan 5, 2015
jump to alternative language file in rails
View gist:7e2c210b973123220ec8
function EditAlternativeLocal()
let filename = bufname("%")
if filename =~ "\.nl\.yml"
let alt_filename = substitute(filename, ".nl.yml", ".en.yml", "g")
execute "e " . alt_filename
elseif filename =~ "\.en\.yml"
let alt_filename = substitute(filename, ".en.yml", ".nl.yml", "g")
execute "e " . alt_filename
endif
endfunction
View upgrade_postgres_91_93_debian
#!/bin/bash
# Update and upgrade packages
sudo apt-get update && sudo apt-get upgrade
# Install postgres 9.3
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3
# Having Postgres 9.1 already, this will create database instance configured to run on port 5433
View rbenv-install-system-wide.sh
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install git build-essential git-core curl libssl-dev \
libreadline-gplv2-dev \
zlib1g zlib1g-dev \
libmysqlclient-dev \
libcurl4-openssl-dev \
libxslt-dev libxml2-dev
View hashtable.rb
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
Pow not loading rvm env solution
View gist:2642915
rvm env . > .powenv
touch tmp/restart.txt
@michel
michel / walrus.rb
Created May 8, 2012
grow a test suite
View walrus.rb
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 Mar 23, 2012
LRUCache code kata 2
View gist:2169470
class LRUCache
def initialize(size = 10)
@size = size
@store = {}
@lru = []
end
def set(key, value)
@store[key] = value
@michel
michel / gist:2169353
Created Mar 23, 2012
Quick vim regex to convert hashrocket (=>) 1.8 to colon syntax (:) 1.9:
View gist:2169353
nmap <leader>rh :%s/\v:(\w+) \=\>/\1:/g<cr>