Skip to content

Instantly share code, notes, and snippets.

@mgrandrath
mgrandrath / gist:f9afff6adb4d64cb7fa7
Created December 7, 2014 11:40
Collect font information from all ElementNodes
function walk(f, node) {
f(node);
node = node.firstChild;
while (node) {
walk(f, node);
node = node.nextSibling;
}
}
function parseNode(node) {
@mgrandrath
mgrandrath / Jakefile.js
Last active August 29, 2015 14:14
Lint a list of files with Jake.js
"use strict";
var TOUCH_DIR_PREFIX = "generated/lint/";
var path = require("path");
var touchFiles = filesToLint().map(touchFileName);
var touchDirs = uniqify(touchFiles.map(path.dirname));
touchDirs.forEach(directory); // this is Jake's `directory` task
@mgrandrath
mgrandrath / README.md
Created November 5, 2015 08:07 — forked from jxson/README.md
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

@mgrandrath
mgrandrath / karma-clientjs.js
Last active November 27, 2015 20:28
Karma configuration for letscodejavascript.com
var karmaCommon = require("./karma-common.js");
module.exports = function(config) {
"use strict";
config.set(Object.assign({}, karmaCommon, {
port: 9876,
basePath: '../../',
const {keys, create, assign} = Object;
function fakeClass(Constructor, prototype) {
const methods = keys(Constructor.prototype);
const overrides = keys(prototype);
methods.forEach(function (method) {
if (!overrides.includes(method)) {
throw new Error(`Method "${method}" missing in Overrides for class [${Constructor.name}]`);
}
});