Skip to content

Instantly share code, notes, and snippets.

Avatar

Craig Hess Leglaw

View GitHub Profile
@Leglaw
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(!Object.is(value, undefined)) this.value = value;
if(description) this.description = description;
@Leglaw
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;" +
You can’t perform that action at this time.