Skip to content

Instantly share code, notes, and snippets.

@domenic
domenic / LICENSE.txt
Last active August 29, 2015 13:56
Correct WTFPL v2 usage, maybe?
Copyright © 2014 Domenic Denicola <domenic@domenicdenicola.com>
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See below for more details.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
@domenic
domenic / LICENSE.txt
Last active August 29, 2015 13:56
"WTPL v4" usage.
Copyright © 2014 Domenic Denicola <domenic@domenicdenicola.com>
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
// Stream type: tcp
* fundamental unit: buffer given to us by the OS
* list representation: array of buffers
read() -> yields a Buffer containing whatever the OS gave us for that chunk
// Stream type: text lines (e.g. after splitting a text files into lines)
* fundamental unit: line (string)
* list representation: array
read() -> yields a string
@domenic
domenic / takeUntil.js
Last active August 29, 2015 13:57
takeUntil over iterable of promises
function takeUntil(iterable, predicate) {
return takeUntilImpl(iterable[Symbol.iterator](), predicate);
}
function takeUntilImpl(iterator, predicate) {
var nextResolve;
var isDone = false;
var nextPromise = new Promise(r => nextResolve = r);
iterator.next().then(function (value) {
@domenic
domenic / async-function-start.js
Last active August 29, 2015 14:00
async function*
async function* myAsyncGenerator() {
console.log("hi");
await Q.delay(1000);
var a = yield 10;
await Q.delay(100);
var b = yield 20;
@domenic
domenic / normal-js-objects-in-web-crypto.md
Last active August 29, 2015 14:00
Using normal JS objects in Web Crypto

Our goal is to eliminate the non-constructible KeyAlgorithm interface, and all its derived counterparts (e.g. RsaKeyAlgorithm). We can just use plain JavaScript objects instead, represented by their counterpart Algorithm dictionaries (e.g. RsaKeyParams).

As WebIDL is lacking in technology for manipulating JS objects, this will require a line or two of prose.

On Formalization

One problem with the existing spec that makes formalizing this difficult is that the spec sets readonly attributes on instances, which should be impossible. E.g. section 18.4.5, Generate Key, step 12 says "Set the algorithm attribute of publicKey to be algorithm": but the algorithm attribute is readonly, and so it cannot be set.

We can work around this, without having to make extensive disruptive changes to the spec, by granting the spec special powers to set readonly attributes. We need to specially call out the interaction of these special powers with normal attribute semantics, however. We'll see that in action bel

function ResourceBuilder(){
this._dependencyPromises = [];
}
ResourceBuilder.prototype._load = function () {
// specific to the resource...
};
ResourceBuilder.prototype.addDependency = function(dep){
this._dependencyPromises.add(dep);
@domenic
domenic / removing-module-x-from-y.md
Last active August 29, 2015 14:02
Practical implications of removing `module x from "y"`

Practical Implications of Removing module x from "y"

Background

According to this gist, the modules break-out session at TC39 (a subset of the larger committee) decided to remove the

module x from "y";
@domenic
domenic / default-export.md
Last active August 29, 2015 14:02
Default default export = MIO?

Intro

Idea: could we make the "default default export" the module instance object?

So for:

// a.js
export const x = 1;
export const y = 2;
@domenic
domenic / discourse-1-headers.txt
Created June 13, 2014 04:42
Trying to decipher Outlook 2013 threading heuristics
Received: from DM2PR05MB335.namprd05.prod.outlook.com (10.141.105.150) by
BN1PR05MB325.namprd05.prod.outlook.com (10.141.62.139) with Microsoft SMTP
Server (TLS) id 15.0.949.11 via Mailbox Transport; Fri, 13 Jun 2014 02:42:58
+0000
Received: from BY2PR05CA002.namprd05.prod.outlook.com (10.242.32.32) by
DM2PR05MB335.namprd05.prod.outlook.com (10.141.105.150) with Microsoft SMTP
Server (TLS) id 15.0.954.9; Fri, 13 Jun 2014 02:42:56 +0000
Received: from BN1AFFO11FD017.protection.gbl (2a01:111:f400:7c10::136) by
BY2PR05CA002.outlook.office365.com (2a01:111:e400:2c2a::32) with Microsoft
SMTP Server (TLS) id 15.0.959.24 via Frontend Transport; Fri, 13 Jun 2014