Skip to content

Instantly share code, notes, and snippets.

View Edward-Lombe's full-sized avatar

Edward Lombe Edward-Lombe

  • Canberra, Australia
View GitHub Profile
@Edward-Lombe
Edward-Lombe / cache.txt
Created June 20, 2018 00:35
Cache $char vs JavaScript String.fromCharCode
0:
1:
2:
3: 
4: 
5: 
6: 
7:
8:
9:
@Edward-Lombe
Edward-Lombe / flatten.js
Last active April 6, 2017 04:11
Simple, compatible implementation of a recursive flatten function, now with tests
// Polyfill isArray if needed
if (typeof Array.isArray !== 'function') {
Array.isArray = isArray
}
function isArray(arg) {
return Object.prototype.toString.call(arg) === '[object Array]'
}
if (typeof module === 'object') {
module.exports = flatten
{
"rulesDirectory": "./node_modules/tslint-eslint-rules/dist/rules",
"rules": {
"align": [
true,
"parameters",
"arguments",
"statements"
],
"max-line-length": [
var exec = require('child_process').exec;
// alternative ultra-short ECMA2015 version
// setInterval(a=>require('child_process').exec('git pull',(b,c,d)=>{console.log(b||c||d)}),6e4)
setInterval(function() {
exec('git pull', puts);
}, 60 * 1000);
function puts(error, stdout, stderr) {
@Edward-Lombe
Edward-Lombe / equals.js
Last active March 28, 2017 18:38
Strict Deep Javascript equality
beforeEach(function() {
jasmine.addMatchers({
toStrictlyEqual : function() {
return {
compare : function(actual, expected) {
var result = {};
result.pass = equals(actual, expected, function (a, b, sPath) {
result.message = 'Expected ' + sPath + ' = ' + b + ' to equal ' + a;
});
return result;