Skip to content

Instantly share code, notes, and snippets.

View jmgunn87's full-sized avatar

James Marshall-Gunn jmgunn87

View GitHub Profile
var assert = require('assert');
module.exports.count = 0;
Object.keys(assert).forEach(function (k) {
module.exports[k] = function () {
assert[k].apply(undefined,
Array.prototype.slice.apply(arguments));
++module.exports.count;
@jmgunn87
jmgunn87 / ORP.css
Last active January 24, 2020 11:48
optimal recognition point for a word
* {font-family:monospace}
.g { text-align: center; font-size:36px }
.v { text-align: center; font-size:36px }
.l { margin:0;padding:0;color: black;}
.p { margin:0;padding:0;color: red; }
.r { margin:0;padding:0;color: black; }
@jmgunn87
jmgunn87 / C.js
Last active August 29, 2015 13:57
dependency injection container
function Container() {
this.s = {};
}
Container.prototype = {
put: function (i, v, o) {
return this.s[i] = !o ? v : function (p) {
return this.c = this.c || v(p);
};
},
@jmgunn87
jmgunn87 / hsbc.js
Created March 16, 2014 22:02
scrape all the statements!
function Transaction(data) {
this.paidIn = parseFloat(data.paidIn);
this.paidOut = parseFloat(data.paidOut);
this.balance = parseFloat(data.balance);
this.description = data.descritpion;
this.Date = data.date;
this.type = data.type;
}
//turm 'em all into CSV
@jmgunn87
jmgunn87 / LICENSE.txt
Created February 22, 2014 20:01 — forked from jed/LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
var start = 'HEAD';
var end = 'fc402a5d37302265f87c77b2abe6cb06cde276b0';
require('child_process').exec(
'git log --grep="\\[.*]" --no-merges ' + end + '~1..' + start,
function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
console.log('exec error: ' + error);
})
fun! Require(...)
if !system("npm install " . join(a:000, " ") . " --save")
let result = []
for dep in a:000
call add(result, substitute("var x = require('x');\n", "x", dep, "g"))
endfor
put = join(result, '')
endif
endfunction
command! -nargs=* RQ call Require(<f-args>)
function Storage(config) {
this.store = config || {};
}
Storage.prototype.put = function (key, object, params, done) {
done = done || params;
return done(null, this.store[key] = object);
};
Storage.prototype.get = function (key, params, done) {
var diff = require('deep-diff').diff;
var yaml = require('js-yaml');
var es = require('event-stream');
var fs = require('vinyl-fs');
var tokens = {};
fs.src([
"./modules/**/config/locales/en.yml",
"./modules/**/config/locales/ru.yml"
]).pipe(es.map(function (file, callback) {
@jmgunn87
jmgunn87 / TCP-32764.js
Last active January 4, 2016 05:09
TCP-32764.js
var bufferpack = require('bufferpack');
var net = require('net');
var commands = {
DUMP_CFG : 1,
GET_CFG : 2,
SET_CFG : 3,
COMMIT_NVRAM : 4,
BRIDGE_ON : 5,
SPEED_TEST : 6,