Skip to content

Instantly share code, notes, and snippets.

@jugglinmike
jugglinmike / arrow-function.js
Last active January 19, 2016 15:54
Prototype of test templates for Test262
/*---
path: language/expressions/arrow-function/dstr-
name: arrow function expression
es6id: 14.2.16
info: |
ArrowFunction : ArrowParameters => ConciseBody
[...]
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
[...]
@jugglinmike
jugglinmike / index.js
Last active September 22, 2015 13:52
Experiment for Tim!
'use strict';
var spawn = require('child_process').spawn;
function parent() {
var child = spawn('node', [__filename, 'something else']);
child.on('exit', function() {
console.log('The child has exited.');
});
@jugglinmike
jugglinmike / app.js
Last active August 29, 2015 14:24
foo
(function() {
'use strict';
var data = [
{ date: '5-Jul-11', close: 349.43 },
{ date: '1-Jul-11', close: 343.26 },
{ date: '30-Jun-11', close: 335.67 },
{ date: '29-Jun-11', close: 334.04 },
{ date: '28-Jun-11', close: 335.26 },
{ date: '27-Jun-11', close: 332.04 },
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
I, Dionysis Zindros, a contributor of JSHint under the e-mail [email protected]
am agreeing to the relicensing of my contributions under the MIT Expat license [1]
I understand that my contributions were previously available under the JSON license [2]
I agree that in particular the following contributions may be relicensed:
@jugglinmike
jugglinmike / question.md
Last active August 29, 2015 14:15
Question on ES6 Iterables

I'm trying to understand the behavior of iterables in Firefox Nightly and V8. Specifically, I am looking at how the runtime is supposed to behave when the iterable's Symbol.iterator method returns a non-object value. Here are the relevant parts of the specification (as I understand it):

13.6.4.13 Runtime Semantics: ForIn/OfBodyEvaluation

The abstract operation ForIn/OfBodyEvaluation is called with arguments lhs, stmt, iterator, lhsKind, and labelSet. The value of lhsKind is either assignment, varBinding or lexicalBinding.

  1. Let oldEnv be the running execution context’s LexicalEnvironment.
  2. Let V = undefined .
  3. Let destructuring be IsDestructuring of lhs.
  4. If destructuring is true and if lhsKind is assignment, then
@jugglinmike
jugglinmike / error.js
Created February 7, 2015 23:10
Mocha error
'use strict';
describe('describe1', function() {
describe('describe2', function() {
it('test', function(done) {
setTimeout(function() {
throw new Error('global error');
}, 0);
setTimeout(function() {
done(new Error('test error'));
@jugglinmike
jugglinmike / isStmtBoundary.js
Created January 10, 2015 21:17
Utility function for JSHint
function isStmtBoundary(first, second) {
if (first.id === "(begin)" || first.id === ";") {
return true;
}
if (first.left || first.arity === "unary" || first.exps) {
return false;
}
return !isEndOfStmt(second) && !isInfix(second) && first.line !== second.line;
@jugglinmike
jugglinmike / promise-stream.js
Created January 10, 2015 00:55
Node.js Promise Stream
'use strict';
var stream = require('stream');
var util = require('util');
var Promise = require('bluebird');
function PStream() {
stream.PassThrough.call(this);
var _promise = new Promise(function(resolve, reject) {
this.on('end', resolve);
this.on('error', reject);
@jugglinmike
jugglinmike / range.md
Last active August 29, 2015 14:12
Contraining date ranges with a date range

The before parameter should filter the set to only include phases that were active before the date specified (this means they started before the given date). The after parameter should filter the set to only include phases that were active after the date specified (this means they ended after the given date).

Here, only "Phase 1" would be selected because it started before the given date:

Time     -------------------->
             before
               |
               V
Phase 1:  x  x
@jugglinmike
jugglinmike / disruption.md
Last active August 29, 2015 14:08
"Disruption" in *Who Owns the Future* by Jaron Lanier

The terminology of "disruption" has been granted an almost sacred status in tech business circles. It is ordinary for a venture capital firm to advertise that it is seeking to fund business plans that "shrink markets." To disrupt is the most celebrated achievement. In Silicon Valley, one is always hearing that this or that industry is ripe for disruption. We kid ourselves, pretending that disruption requires creativity. It doesn't. It's always the same story.

Technologists repeatedly apply the extreme efficiencies of digital networks in some area of endeavor in such a way that the sources of value, whatever they may be, are left more off-the-books than they used to be, but we end up in control of the server that runs the scheme. It happened to music and other media early on, but the pattern is being repeated everywhere.

[...] "Disruption" by the use of digital network technology undermines the very idea of markets and capitalism. Instead of economics being about a bunch of players with unique position