Skip to content

Instantly share code, notes, and snippets.

View tobyhede's full-sized avatar
👨‍🚀
...

Toby Hede tobyhede

👨‍🚀
...
View GitHub Profile
@tobyhede
tobyhede / cheat.md
Created August 25, 2011 11:51
Rails Cheat Sheet
# Update RVM (the ruby version manager)
rvm get latest

# From the project directory
# RVM may ask you if the settings are ok, they are
gem install bundler
bundle install

bundle exec rake db:create db:migrate db:seed
@tobyhede
tobyhede / rserve.md
Created September 15, 2011 02:14
rserve

In .bash_profile (or what have you)

function rserve () {
    ruby -rwebrick -e"s = WEBrick::HTTPServer.new(:Port => 3000,  :DocumentRoot => Dir.pwd); trap('INT') { s.shutdown }; s.start"

}

@tobyhede
tobyhede / ode
Created November 3, 2011 22:27
Reflections on one's last day of full-time work
Change one line
Run compile task
Run jar task
Run run task
Test
****
Still doesn't work
Change one line
Goto 0
@tobyhede
tobyhede / wai-handler-devel.md
Created December 19, 2011 22:33
Haskell & WAI: wai-handler-devel command not found

After updating Haskell GHC to Version 7.0.4, wai-handler-devel stopped working, responding with "command not found"

The fix is to add the correct path ($HOME/Library/Haskell/bin) to your .bash_profile

export PATH="$HOME/Library/Haskell/bin;$PATH"
@tobyhede
tobyhede / reinvent_the_wheel.js
Created January 21, 2012 01:32
Ideas for light-weight node middleware functions
/*
Ideas for light-weight node middleware functions
Riffing on ideas for weaving functions together in a middleware architecture for node.
Overview:
a function that returns a rack-style array of status, headers and body
Function Requirements:
access to the environment (essentially the raw node request and response objects)
@tobyhede
tobyhede / spaghetti.js
Created January 22, 2012 00:25
node.js spaghetti
// From: https://github.com/christkv/node-mongodb-native
// Not picking on the driver itself, it appears to be idiomatic node javascript
// Custom factory (need to provide a 12 byte array);
CustomPKFactory = function() {}
CustomPKFactory.prototype = new Object();
CustomPKFactory.createPk = function() {
return new ObjectID("aaaaaaaaaaaa");
}
@tobyhede
tobyhede / idiom.md
Created February 19, 2012 05:11
Clojure idioms

remove nil values from map

(defn remove_nils [col]
  (into {} (remove (comp nil? v) col)))

check if list/collection contains a value

(some #{:value} collection)
@tobyhede
tobyhede / index.txt
Created February 22, 2012 03:10 — forked from mmcgrana/index.txt
For each Ruby module/class, we have Ruby methods on the left and the equivalent
Clojure functions and/or relevant notes are on the right.
For clojure functions, symbols indicate existing method definitions, in the
clojure namespace if none is explicitly given. clojure.contrib.*/* functions can
be obtained from http://github.com/kevinoneill/clojure-contrib/tree/master,
ruby-to-clojure.*/* functions can be obtained from the source files in this
gist.
If no method symbol is given, we use the following notation:
@tobyhede
tobyhede / translate.md
Created March 6, 2012 01:05
translating common tech recruitment terms

Jedi

`

Rock Star

Have your creative output co-opted and blandly packaged by faceless corporate middlemen. Suitable for vain, undisciplined, egotistical, obnoxious or temperamental characters.

Ninja

@tobyhede
tobyhede / crate.cljs
Created March 30, 2012 05:23
cljs and crate/hiccup
(defhtml db-list [databases]
[:table{:class "table table-bordered table-striped"}
[:thead
[:tr
[:th "Database"]
[:th "Collections"]
[:th "Storage"]
[:th "Allocated"]
[:th "Actions"]
]