I hereby claim:
- I am guscaplan on github.
- I am snek (https://keybase.io/snek) on keybase.
- I have a public key whose fingerprint is 24E8 BBD2 DA10 B312 CF16 4CA2 58CC E2A2 4E2D 41DC
To claim this, I am signing this object:
"use strict"; | |
var oxford = require('project-oxford'); | |
var client = new oxford.Client('TOKEN'); | |
var gm = require('gm'); | |
var http = require('http'); | |
var fs = require('fs'); | |
function getFilesize(filename) { | |
var stats = fs.statSync(filename) |
'use strict'; | |
class EventEmitter { | |
on(e, d) { | |
window.addEventListener(e, eOn); | |
function eOn(e) { // this function is optional, but you will need to use d.details in your event listener | |
d.apply(this, e.detail) | |
} | |
} |
'use strict'; | |
/** | |
* @class EventEmitter | |
* @example | |
* var e = new EventEmitter(); | |
* | |
* e.on('hello', console.log); // 'hi how are you' | |
* | |
* e.emit('hello', 'hi', 'how are you'); |
const leftpad = (v, n, c = '0') => String(v).length >= n ? '' + v : (String(c).repeat(n) + v).slice(-n); | |
class Snowflake { | |
constructor ({ epoch, workerId, datacenterId } = { 1288834974657, 1, process.pid }) { | |
this.epoch = epoch; | |
this.workerId = workerId; | |
this.dataCenterId = datacenterId; | |
this.incId = 0; | |
} |
I hereby claim:
To claim this, I am signing this object:
function applyEachSeries(array, ...args) { | |
const iterator = array[Symbol.iterator](); | |
const final = args.pop(); // performance? | |
(function cb() { | |
const x = iterator.next(); | |
if (x.done) return final(); | |
x.value(...args, cb); | |
})(); | |
} |
function callbackify (promise) { | |
return function execute() { | |
const callback = arguments[arguments.length - 1]; | |
const args = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | |
if (promise instanceof Promise) promise.then(r => callback(null, r)).catch(callback); | |
else if (typeof promise === 'function') promise(...args).then(r => callback(null, r)).catch(callback); | |
else throw new TypeError('`promise` must be a Promise or Function which returns a Promise!'); | |
} | |
} |
function promisify (fn, thisArg = null) { | |
return (...args) => { | |
return new Promise((resolve, reject) => { | |
const callback = (err, res) => { | |
if (err) return reject(err); | |
return resolve(res); | |
} | |
fn.apply(thisArg, [...args, callback]); | |
}); | |
} |
-----BEGIN PGP MESSAGE----- | |
Version: Keybase OpenPGP v2.0.61 | |
Comment: https://keybase.io/crypto | |
wcFMA80pP6OGefUcAQ//eSm8iqTYlRwKjPFwIdSzi9phcT1fC2trfQ8/Pg3bEaST | |
O0F2N2WBR+jsbSarTFFQjS5s2xp8fEDjGSmTT8MntS3ZPai5DtN7OAYHxmGNSHx6 | |
3DNrCCE05k2UOe3hcONY5o3hZUh6BCcmispn/a68HetohEJqd9ZYfFi5ouHHAMK7 | |
BjuXwYV/5jHihiP/Vxe9gRFm0Hd5doVZNcTF8XbTsSDMkn9nORNUYWUirwnBVW3U | |
/sQmX3IjH2PskH70YAS/WVRm/U6ibB/XuQRkJ0SrSFq4N7Ld5MGDyDTr/EoAHVyg | |
scFqa41jawHyEBwHhGdWg0hTA7q+RvQpQwpHuC7sFkaewPVKghwLqDH2tDvNAtox |
class Ratelimiter { | |
constructor (options = { timeout: 1, limit: 5 }) { | |
this.tracked = {}; | |
this.limit = options.limit; | |
setInterval(() => { | |
for (const x in this.tracked) { | |
if (this.tracked[x] > 0) this.tracked[x]--; | |
} |