Skip to content

Instantly share code, notes, and snippets.

View alanhussey's full-sized avatar
🐎
everything happens so much

Alan Hussey alanhussey

🐎
everything happens so much
View GitHub Profile
@mklabs
mklabs / pre-commit
Created November 15, 2011 17:28
run jshint as git/hg hooks, NO COMMIT IF NO LINT FREE.
#!/usr/bin/env node
// todo: try to require jshint here, instead of spawning process, then fallback to spawning process.
var jshint = nrequire('jshint');
if (jshint) return process.exit(0);
// jshint not installed locally, spawn process instead.
// basically the same, but less pretty.
var exec = require('child_process').exec;
@dafrancis
dafrancis / README.md
Last active December 11, 2015 12:09
Why would anyone want to use templating languages when you can use SPEEDY document.createElement()? #WOW #COOL #YOLO

DONUT (DO Not Use This)

Tired of those horribly slow templating languages?

Want a super fast templating language that doesn't involve strings?

Do you like your libraries small and simple?

Then DO Not Use This

@mjackson
mjackson / resolvePromise.js
Last active September 9, 2018 08:23
An easy way to do async APIs in JavaScript that support both promises *and* callbacks!
// Here is a function that I use all the time when creating public
// async APIs in JavaScript:
const resolvePromise = (promise, callback) => {
if (callback)
promise.then(value => callback(null, value), callback)
return promise
}
// Sometimes I like to use callbacks, but other times a promise is
/*
A copy of https://gist.github.com/airhadoken/8742d16a2a190a3505a2
See also: https://botwiki.org/bots/twitterbots/emoji__polls/
*/
var T = require("twit");
var Q = require("Q");
// key and secret for Twitter for iPhone.
// A whitelisted app is needed to access the cards API; you can't just create your own currently.