using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies
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
{ | |
"editor.semanticHighlighting.enabled": false, | |
"editor.tokenColorCustomizations": { | |
"textMateRules": [ | |
{ | |
"scope": [ | |
"support.type.primitive.ts", | |
"entity.name.type.ts", | |
"meta.type.tuple.ts", | |
"meta.type.annotation.ts", |
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 fs = require('fs'); | |
const path = require('path'); | |
const resolve = (...args) => path.join(__dirname, ...args); | |
const lockedVersions = getPackageVersions(resolve('bower_components')); | |
const newBowerContents = buildNewBowerContents(lockedVersions); | |
console.log(`Writing to bower-lock.json`); | |
fs.writeFileSync(resolve('./bower-lock.json'), newBowerContents, 'utf8'); |
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
/** | |
* This solves the problem using Lodash's _.reduceRight, | |
* it runs backwards on the array, and makes each function/int to trigger the next ones | |
*/ | |
function sequence(list = []){ | |
_.reduceRight(list, (next, item) => () => _.isFunction(item) ? next(item()): setTimeout(next, item), () => {})(); | |
} | |
/** | |
* This solves it without using iteration, but tail recursion, |
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
<link rel="import" href="../core-scaffold/core-scaffold.html"> | |
<link rel="import" href="../core-header-panel/core-header-panel.html"> | |
<link rel="import" href="../core-menu/core-menu.html"> | |
<link rel="import" href="../core-item/core-item.html"> | |
<link rel="import" href="../core-icon-button/core-icon-button.html"> | |
<link rel="import" href="../core-toolbar/core-toolbar.html"> | |
<link rel="import" href="../core-menu/core-submenu.html"> | |
<polymer-element name="my-element"> |
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
<link rel="import" href="../ace-element/ace-element.html"> | |
<link rel="import" href="../cool-clock/cool-clock.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
:host { | |
position: absolute; | |
width: 100%; |
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
function Lockable() { | |
this.deferred = $.Deferred(); | |
this.locks = {}; | |
} | |
Lockable.prototype.lock = function (lockName) { | |
this.locks[lockName] = true; | |
return this; | |
} |