Skip to content

Instantly share code, notes, and snippets.

View novemberborn's full-sized avatar

Mark Wubben novemberborn

View GitHub Profile
@novemberborn
novemberborn / Deferred.js
Created June 7, 2012 18:44 — forked from mikewilcox/Deferred.js
Deferred Error Testing
require([
"dojo/Deferred"
], function(Deferred){
var useError = 0;
var getError = function(name, useThisError){
var msg = name + ' error';
if(useError || useThisError){
return function(e){ console.error(msg); d.reject(e); };
}
};
@novemberborn
novemberborn / gist:4399269
Last active December 10, 2015 07:08
Cancelation/A+ Draft A

Cancelation/A+

This proposal specifies how cancelation is triggered, handled and propagated in a Promises/A+ promise library.

Terminology

In addition to the terminology from Promises/A+ we use the following:

  1. OperationCanceled is an error used to reject canceled promises.
  2. "direct cancelation" is when a promise is canceled by the consumer of the promise calling 'cancel'.

Progress/A+

This proposal specifies how progress is triggered and propagated in a Promises/A+ promise library.

Requirements

The then Method

The then method is the same as that specified in the promises-spec except that it also takes a third argument. We'll call that third argument the onProgress:

@novemberborn
novemberborn / gist:4407774
Last active December 10, 2015 08:28
Cancelation/A+ Draft B

Cancelation/A+

This proposal specifies how cancelation is triggered, handled and propagated in a Promises/A+ promise library.

Terminology

In addition to the terminology from Promises/A+ we use the following:

  1. OperationCanceled is an error used to reject canceled promises.
  2. "direct cancelation" is when a promise or resolver is canceled by the consumer of the promise calling cancel.
var legendary = require("legendary");
test1();
test2();
test3();
test4();
test5();
test6();
test7();
@novemberborn
novemberborn / gist:6938771
Created October 11, 2013 17:30
Guide to setting up a local NPM registry

CouchDB

Install CouchDB. This guide assumes 1.3.1. Set up an admin account.

Create the database required by NPM:

curl -X PUT http://admin:password@127.0.0.1:5984/registry
@novemberborn
novemberborn / gist.md
Created August 6, 2015 15:22
Removing all unused docker containers and images
@novemberborn
novemberborn / coverage.sh
Created November 26, 2015 12:11
Code Coverage with Babel, Istanbul & NYC
#!/bin/bash
set -e
# Shell script to compute code coverage even after the Babel transforms have
# been applied.
# Clear previous coverage.
rm -rf coverage
# Generate test coverage based on however `npm test` performs the tests.

Keybase proof

I hereby claim:

  • I am novemberborn on github.
  • I am novemberborn (https://keybase.io/novemberborn) on keybase.
  • I have a public key ASBotTxsIgcNBdJ7414oGO7TAGHyYaUtXfNLUrR3N-maaQo

To claim this, I am signing this object:

@novemberborn
novemberborn / setup.md
Created January 7, 2016 14:28
OS X Dnsmasq setup for .dev domains

Install dnsmasq using Homebrew. Edit the dnsmasq.conf file (Homebrew will tell you where to put it) to contain:

address=/.dev/127.0.0.1
listen-address=127.0.0.1

Then make sure Dnsmasq is running (again follow Homebrew instructions).

Create the /etc/resolver/dev directory (using root) if it doesn't exist yet and create a resolver for .dev: