Skip to content

Instantly share code, notes, and snippets.

@MatthewMueller-Snippets
MatthewMueller-Snippets / gist:2381940
Created April 14, 2012 03:45
RESTful API design
GET / -> index
GET /new -> new
POST / -> create
GET /:id -> show
GET /:id/edit -> edit
PUT /:id -> update
DELETE /:id -> destroy
@MatthewMueller-Snippets
MatthewMueller-Snippets / forEachSync.js
Created April 1, 2012 01:55
Super simple synchronous forEach loop
Array.prototype.forEachSync = function(fn, done) {
if(!this.length) return done(null);
arr = this.reverse();
function next(err) {
if(err) return done(err);
var elem = arr.pop();
if(!elem) return done(err);
return fn(elem, next);
@MatthewMueller-Snippets
MatthewMueller-Snippets / gist:2260183
Created March 31, 2012 07:02
EC2: Add a SSH pem-file to keychain
Add a SSH pem-file to keychain
ssh-add ~/.ssh/mattyair.pem
@MatthewMueller-Snippets
MatthewMueller-Snippets / gist:2259856
Created March 31, 2012 06:06
NPM: Set up path for NPM global modules
echo 'export NODE_PATH="'$(npm root -g)'"' >> ~/.bashrc