Skip to content

Instantly share code, notes, and snippets.

Domenic Denicola domenic

Block or report user

Report or block domenic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@domenic
domenic / LICENSE.txt
Last active Aug 29, 2015
Correct WTFPL v2 usage, maybe?
View LICENSE.txt
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 Aug 29, 2015
"WTPL v4" usage.
View LICENSE.txt
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.
View gist:9077224
// 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 Aug 29, 2015
takeUntil over iterable of promises
View takeUntil.js
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) {
View async-function-start.js
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 Aug 29, 2015
Using normal JS objects in Web Crypto
View normal-js-objects-in-web-crypto.md

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

View resource-builder.js
function ResourceBuilder(){
this._dependencyPromises = [];
}
ResourceBuilder.prototype._load = function () {
// specific to the resource...
};
ResourceBuilder.prototype.addDependency = function(dep){
this._dependencyPromises.add(dep);
@domenic
domenic / async-generators.js
Last active Aug 29, 2015
Push vs. pull async generators
View async-generators.js
async function* foo() {
console.log("1");
await Q.delay(1000);
console.log("2");
yield "a";
console.log("3");
await Q.delay(1000);
console.log("4");
yield "b";
}
@domenic
domenic / removing-module-x-from-y.md
Last active Aug 29, 2015
Practical implications of removing `module x from "y"`
View removing-module-x-from-y.md

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 / discourse-1-headers.txt
Created Jun 13, 2014
Trying to decipher Outlook 2013 threading heuristics
View discourse-1-headers.txt
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
You can’t perform that action at this time.