Skip to content

Instantly share code, notes, and snippets.

View novemberborn's full-sized avatar

Mark Wubben novemberborn

View GitHub Profile
@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 / howto.md
Last active July 31, 2016 14:29
Obtaining Let's Encrypt certificates for CloudFlare origin servers, using wilee
@novemberborn
novemberborn / gist.md
Created August 6, 2015 15:22
Removing all unused docker containers and images
@novemberborn
novemberborn / test.js.md
Created June 28, 2017 11:31
AVA snapshot report

Snapshot report for test.js

The actual snapshot is saved in test.js.snap.

Generated by AVA.

HelloWorld component

Snapshot 1

{
plugins: [
['./plugin', {label: 'plugin'}],
['./plugin', {label: 'plugin'}, 'named']
],
overrides: [
{
test: 'foo.js',
extends: './extends.json5',
plugins: [
@novemberborn
novemberborn / gist:899634
Created April 2, 2011 16:46
Convert pasteboard string into JSON
#!/usr/bin/env node
require("child_process").exec("pbpaste", function(_, stdout){
process.stdout.write(JSON.stringify(stdout.trim()));
});
@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.