This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const fs = require('fs'); | |
const glob = require('glob').sync; | |
const mkdirp = require('mkdirp').sync; | |
const sass = require('node-sass'); | |
const path = require('path'); | |
const streams = require('stream'); | |
const runner = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @module MyModule | |
*/ | |
define(['dep1'], function(dep1) { | |
"use strict"; | |
/** | |
* @param {HTMLElement} element | |
* @param {Object} options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Invoker | |
* Repeatedly invokes a function until it returns a truthy value | |
* | |
* @see https://gist.github.com/branneman/53b820be519b54bfc30a | |
* @param {Number} limit - The amount of total calls before we timeout | |
* @param {Number} interval - The amount of milliseconds between calls | |
* @param {Function} fn - The function to execute, must return a truthy value to indicate it's finished | |
* @param {Function} cb - The callback for when we're finished. Recieves 2 arguments: `error` and `result` | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (c) copyright unscriptable.com / John Hann | |
// License MIT | |
// For more robust promises, see https://github.com/briancavalier/when.js. | |
function Promise () { | |
this._thens = []; | |
} | |
Promise.prototype = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Used for inter-object communication. | |
* (Semi-)drop in replacement for Rik Schennink's Observer. | |
* | |
* Implementation differences: | |
* - ES6 | |
* - The use of WeakMaps | |
* - inform() and conceal() don't return a boolean indicating success. | |
* - Subscription fn's are called with seperate arguments, instead of one data parameter. This is backwards compatible. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parent { | |
constructor() { | |
return new Promise(resolve => { | |
setTimeout(() => resolve({ data: 'important' }), 1e3); | |
}); | |
} | |
} | |
class Child extends Parent { | |
constructor() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
... | |
<script> | |
(function(d){ | |
if (!('querySelector' in d && 'addEventListener' in window)) return; | |
d.documentElement.className += ' has-js'; | |
d.addEventListener('DOMContentLoaded', function() { | |
var s = d.createElement('script'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Pair | |
* @todo Implement algebraic structures: Setoid, Functor | |
*/ | |
var Pair = function(fst, snd) { | |
if (this instanceof Pair) { | |
if (Array.isArray(fst) && fst.length === 2 && typeof snd == 'undefined') { | |
this[0] = fst[0]; | |
this[1] = fst[1]; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
const path = require('path'); | |
const fs = require('fs'); | |
// Expose module | |
module.exports = { encrypt, decrypt }; | |
/** | |
* Encypt against public key | |
* @param {String} str - The string to encrypt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Strict mode | |
* Opt in to a restricted variant of JavaScript. | |
*/ | |
'use strict'; | |
(function() { 'use strict'; }); | |
/** | |
* Array.prototype.forEach() | |
* Executes a provided function once per array element. |