Skip to content

Instantly share code, notes, and snippets.

View awwright's full-sized avatar

Austin Wright awwright

View GitHub Profile
@awwright
awwright / localtabs.md
Last active August 29, 2015 14:10 — forked from eevee/spabs.md

Death to spaces, long live tabs

Why tabs?

  1. No more arguments over how many spaces an indent is, and no more inconstistent indenting throughout the project, no more problems when copying/pasting examples. Indent is one tab, period. An indent will never be two tabs, ever.
  2. You can't accidently highlight half a tab

Tabs must only be found at the beginning of a line.

Checking out space indents as tabs in Git

@awwright
awwright / gist:5923322
Last active December 19, 2015 08:09 — forked from apipkin/gist:5923314
spinner = {
fn: function () {
var char = spinner.chars[++spinner.offset%spinner.chars.length];
process.stdout.write('\x1B[s' + char + '\x1B[u');
},
chars: ['—', '\\', '|', '/'],
offset: 0
timer: null,
speed: 100
// Would prefer to use an actual Function-subclass a lá `from`, so that I don't have to manually
// attach a .toString() to each instance; but this will do for the moment.
// FIXME: Will currently error out if you curry in more arguments than the function needs
define(Function.prototype, 'curry', function(){
var self = this;
var result = new Function('bound', 'args',
"return this.apply("
+" typeof bound === 'object' || typeof bound === 'function'? bound:this"
+" , curried.concat([].slice.call(args)) )"
@awwright
awwright / protoinspect.js
Created November 18, 2012 17:45 — forked from jonvuri/protoinspect.js
Inspect prototypes
var util=require('util');
module.exports = function protoinspect(object, showHidden, depth, colors) {
return util.inspect(object, showHidden, depth, colors) + '\n' + (Object.getPrototypeOf(object)!=Object.prototype ? protoinspect(Object.getPrototypeOf(object), showHidden, depth, colors) : '');
}
module.exports.log = function protoinspectLog(object, showHidden, depth){
console.log(module.exports(object, showHidden, depth, true));
}