I hereby claim:
- I am ralucas on github.
- I am ralucas (https://keybase.io/ralucas) on keybase.
- I have a public key ASBUfQqvrlC3kr_bMMzSJYDOTPVNLVupYmfoBTOa_QeHKQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Object.getOwnPropertyNames(Klass.prototype).forEach(k => { | |
if (k !== 'constructor') { | |
Klass.prototype[k] = function() { | |
// do something here on hijacked fn | |
} | |
} | |
} | |
}); |
const express = require('express'); | |
const path = require('path'); | |
const logger = require('morgan'); | |
const bodyParser = require('body-parser'); | |
const axios = require('axios'); | |
const app = express(); | |
// view engine setup |
const Readable = require('stream').Readable; | |
const Transform = require('stream').Transform; | |
const S3_BUCKET = 'name_of_bucket'; // This will probably be more variable than a constant | |
function createBodyStream(body) { | |
return new Readable({ | |
read() { | |
this.push(Buffer.from(body)); | |
this.push(null); |
module.exports = { | |
'1000': '1000', | |
'1001': '1001', | |
'1002': '1002', | |
'1003': '1003', | |
'1004': '1004', | |
'1005': '1005', | |
'1007': '1007', | |
'1008': '1008', | |
'1009': '1009', |
function binaryToDecimal(binStr) { | |
return binStr.split('').reverse().reduce((agg, v, i) => { | |
return agg + (Math.pow(2, i) * Number(v)); | |
}, 0); | |
} | |
// or | |
function binaryToDecimal(binStr) { | |
let output = 0; |
function getRandomBytes() { | |
const fd = fs.openSync('/dev/urandom', 'r'); | |
const buf = Buffer.alloc(256); | |
fs.readSync(fd, buf, 0, 256); | |
return buf; | |
} | |
function getResetHash() { | |
const buf = getRandomBytes(); | |
return crypto.createHash('sha256').update(buf).digest('hex'); |
const HtmlParser = require('htmlparser2'); | |
function clean(parsedHtml) { | |
return parsedHtml.filter((item) => { | |
return !item.data || item.data.trim(); | |
}); | |
} | |
module.exports = function(html) { | |
let results = []; |
function someFn() { | |
let resolution = Promise.resolve(); | |
let promises = [array, of, promises]; | |
promises.forEach(fn => { | |
resolution = resolution.then((result) => fn(result)); | |
}); | |
return resolution; | |
} |