Skip to content

Instantly share code, notes, and snippets.

View CodeLenny's full-sized avatar

CodeLenny CodeLenny

  • Massachusetts
View GitHub Profile
@CodeLenny
CodeLenny / Makefile
Last active January 29, 2019 01:11
bike-workout-dsl stylesheet
all: stylesheet.css
upstream.scss: upstream.url
curl "`cat upstream.url`" > upstream.scss
node_modules/.bin/sass:
npm install sass
stylesheet.css: upstream.scss stylesheet.scss
node_modules/.bin/sass stylesheet.scss > stylesheet.css
<script>
/**
* Delays the given number of milliseconds.
* @param {Number} ms the number of milliseconds to delay.
* @return {Promise} resolves after the delay has finished.
*/
Promise.delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
</script>
<script>
/**
* Wait for a condition to be true before continuing.
* @param {Number} [delay] a timeout (in ms) for when an error should be thrown for a function that will never be true.
* Defaults to `2000`.
* @param {Function<Boolean>} fn the function to poll to determine if the program should continue.
* Return `true` when the Promise should resolve.
* @return {Promise} resolves when `fn` returns `true`. Rejects with an `EvalError` if `fn` doesn't return `true` before `delay`.
*/
window.waitFor = function(delay, fn) {
@CodeLenny
CodeLenny / index.html
Created August 8, 2017 14:47 — forked from anonymous/index.html
Mocha Testing via PolyGit Browser testing with Mocha and Chai loaded through PolyGit // source https://jsbin.com/felaqoq
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta name="description" content="Browser testing with Mocha and Chai loaded through PolyGit">
<title>Mocha Testing via PolyGit</title>
</head>
<body>
<script src="https://polygit2.appspot.com/components/webcomponentsjs/webcomponents-lite.js"></script>
@CodeLenny
CodeLenny / AVA Tips.adoc
Last active June 27, 2017 20:03
AVA Tips

AVA Tips and Hacks

(None of this is official, and some of it should be very carefully used)

Tips

Hide a Test

let x = new Error("Test");
Promise
.resolve(x)
.then(() => console.log("Good"))
.catch() => console.log("Bad"));
// => "Bad"
@CodeLenny
CodeLenny / README.md
Created May 28, 2017 22:32
National Park List
@CodeLenny
CodeLenny / deep-reference.json
Last active March 16, 2017 19:50
REST API Endpoint
{
"document": {
"$ref": "document.json"
},
"value": {
"$ref": "document.json#bar/baz"
}
}
###
Created for http://stackoverflow.com/questions/34982953/child-process-stream-backpressure
Please pardon the CoffeeScript, but I couldn't stand to extend stream.Transform in native JavaScript.
###
fs = require("fs")
execStream = require("exec-stream")
brake = require("brake")
file = fs.createWriteStream("tmp.txt")

Keybase proof

I hereby claim:

  • I am codelenny on github.
  • I am codelenny (https://keybase.io/codelenny) on keybase.
  • I have a public key ASCNDhBbNEXs76GUdb2Pz6y7Q1TflbkkWeotSuIjW3oi_Qo

To claim this, I am signing this object: