Skip to content

Instantly share code, notes, and snippets.

View wookiehangover's full-sized avatar
💭
just setting up my gthb...

Sam Breed wookiehangover

💭
just setting up my gthb...
View GitHub Profile
@paulirish
paulirish / README.md
Created January 4, 2010 02:38
imagesLoaded() jquery plugin
@cowboy
cowboy / jquery.ba-whenthen.js
Created March 12, 2011 13:59
jQuery's "when" and "then" all rolled up together.
/*!
* jQuery whenthen - v0.2 - 3/12/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
@cowboy
cowboy / multi-firefox-fixer.sh
Created March 14, 2011 02:17
Multi-Firefox Fixer: Run multiple versions of Firefox simultaneously! (note: doesn't work on Windows)
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" ]; then cat <<EOF
Multi-Firefox Fixer - v0.2 - 4/26/2011
http://benalman.com/
Usage: `basename "$0"`
Run this shell script from beside (in the same parent directory as) one or more
Firefox*.app or Aurora*.app applications and it will "fix" those Firefoxes to
@tbranyen
tbranyen / server.js
Last active July 4, 2021 18:44
backbone/node.js pushState enabled server
// Require libraries
var os = require("os");
var fs = require("fs");
var readline = require("readline");
var cluster = require("cluster");
var express = require("express");
var site = express();
// Var up, bro
var i, read;
@wookiehangover
wookiehangover / Cakefile
Created December 24, 2011 08:25
a pretty-good build script, with Cake
# Dependencies
fs = require('fs')
{_} = require('underscore')
path = require('path')
tmpl = require('handlebars-jst')
{log} = require('util')
growl = require('growl')
stitch = require('stitch')
uglify = require('uglify-js')
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@wookiehangover
wookiehangover / less-middleware.js
Last active December 14, 2015 21:18
Express Middleware for processing less on the fly in development mode.
/*
* Less Middleware
*
* Captures requests for your production css and serves a compiled less bundle
* in its place. Less parser is pretty quick, no noticeable load times when
* parsing bootstrap & custom less on every request. Errors are printed to the
* console.
*
* Meant to be mounted to your css directory, eg:
*
@wookiehangover
wookiehangover / define-wrapper.js
Created May 18, 2013 05:59
connect middleware that wraps serves common-js modules wrapped with AMD define()
var fs = require('fs');
var path = require('path');
var url = require('url');
module.exports = function(directory, blacklist) {
if( directory === undefined ) {
throw new Error('You need to pass a location to work with');
}
blacklist = blacklist || [];
@brianloveswords
brianloveswords / git-obliterate
Last active January 24, 2024 12:28
git-obliterate: for removing sensitive files you may have committed from the entire history of the project.
#!/bin/bash
file=$1
test -z $file && echo "file required." 1>&2 && exit 1
git filter-branch -f --index-filter "git rm -r --cached $file --ignore-unmatch" --prune-empty --tag-name-filter cat -- --all
git ignore $file
git add .gitignore
git commit -m "Add $file to .gitignore"

Minimum Viable Async with Node 6

With the release of Node 6.0.0, the surface of code that needs transpilation to use ES6 features has been reduced very dramatically.

This is what my current workflow looks like to set up a minimalistic and fast microservice using micro and async + await.

The promise