Skip to content

Instantly share code, notes, and snippets.


Craig Hess Leglaw

  • Shamrock Trading Corporation
  • Overland Park, KS
View GitHub Profile
Leglaw / await-vs-promise-all-concurrency.js
Last active Feb 3, 2021
Await vs Promise.all concurrency comparison
View await-vs-promise-all-concurrency.js
async function doWork(forSeconds, label) {
return new Promise((resolve) => {
setTimeout(() => {
resolve(`doWork took ${forSeconds}`);
}, forSeconds * 1000);
Leglaw / Enum.es6.js
Created Nov 14, 2015 — forked from xmlking/Enum.es6.js
JavaScript Enums with ES6, Type Checking and Immutability
View Enum.es6.js
export class EnumSymbol {
sym = Symbol.for(name);
value: number;
description: string;
constructor(name: string, {value, description}) {
if(!, undefined)) this.value = value;
if(description) this.description = description;
Leglaw / dbgWatch.js
Last active Sep 22, 2015
Display latest value of a variable instead of flooding your console with log entries with this handy script. Call dbgWatch with 2 parameters: variable name, variable value, and it places it in a fixed-position div on the page. You can move the div around as needed.
View dbgWatch.js
* Debugging
(function() {
var body = document.getElementsByTagName('body')[0],
divWatch = document.createElement('div');
cssText = "font-family: 'Lucida Console', monospace;" +
"font-size: 12px;" +
"line-height: 1em;" +
"white-space: nowrap;" +