Skip to content

Instantly share code, notes, and snippets.

Sam Breed wookiehangover

Block or report user

Report or block wookiehangover

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Readme.md

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

@brianloveswords
brianloveswords / git-obliterate
Last active Jul 4, 2019
git-obliterate: for removing sensitive files you may have committed from the entire history of the project.
View git-obliterate
#!/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"
@wookiehangover
wookiehangover / define-wrapper.js
Created May 18, 2013
connect middleware that wraps serves common-js modules wrapped with AMD define()
View define-wrapper.js
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 || [];
@wookiehangover
wookiehangover / less-middleware.js
Last active Dec 14, 2015
Express Middleware for processing less on the fly in development mode.
View less-middleware.js
/*
* 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:
*
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

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 / Cakefile
Created Dec 24, 2011
a pretty-good build script, with Cake
View Cakefile
# 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')
@tbranyen
tbranyen / server.js
Last active Jul 28, 2019
backbone/node.js pushState enabled server
View server.js
// 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;
@cowboy
cowboy / multi-firefox-fixer.sh
Created Mar 14, 2011
Multi-Firefox Fixer: Run multiple versions of Firefox simultaneously! (note: doesn't work on Windows)
View multi-firefox-fixer.sh
#!/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
@cowboy
cowboy / jquery.ba-whenthen.js
Created Mar 12, 2011
jQuery's "when" and "then" all rolled up together.
View jquery.ba-whenthen.js
/*!
* 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/
*/
@paulirish
paulirish / README.md
Created Jan 4, 2010
imagesLoaded() jquery plugin
View README.md
You can’t perform that action at this time.