This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./include/apreq_error.h:#define APREQ_ERROR_OVERLIMIT (APREQ_ERROR_MISMATCH + 1) | |
./include/apreq_error.h:#define APREQ_ERROR_UNDERLIMIT (APREQ_ERROR_MISMATCH + 2) | |
./include/http_core.h:#if APR_HAVE_STRUCT_RLIMIT | |
./include/http_core.h:#ifdef RLIMIT_CPU | |
./include/http_core.h: struct rlimit *limit_cpu; | |
./include/http_core.h:#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS) | |
./include/http_core.h: struct rlimit *limit_mem; | |
./include/http_core.h:#ifdef RLIMIT_NPROC | |
./include/http_core.h: struct rlimit *limit_nproc; | |
./modules/apreq/filter.c: ctx->body_status = APREQ_ERROR_OVERLIMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// something about delaying a pipe causes child process stdout to become `readable:false` | |
function test(prefix, delay_fn, cb) { | |
var x=new (require("stream").Transform); | |
x._transform = (function (chunk, enc, cb) { | |
console.log(prefix, 'chunk:', chunk); | |
cb(null); | |
}) | |
var child=require("child_process").spawn("head", ["-c","-2"]); | |
child.on('exit', function () { | |
console.log('exit', prefix); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function i_cant_event(is_even, sentry onError) { | |
if (is_even % 2 !== 0) { | |
// invoke onError(err) , only 1 param goes through | |
// return undefined | |
throw new Error('not even'); | |
} | |
} | |
function i_cant_event(is_even, sentry onError) { | |
// invoke onError(err) , only 1 param goes through | |
// return undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let tee = (a) => {console.log(String(a)); return a} | |
// our applicator | |
let $_ = (n) => { | |
let args = new Array(n); | |
for (let i = 1; i <= n; i++) { | |
args[i-1] = `$${i}` | |
} | |
return (raw, ...values) => | |
Function(...args.concat(tee('return ' + raw.reduce( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function greet() { | |
var done = false; | |
var who = undefined; | |
var states = { | |
BEFORE_HELLO: function (value, err) { | |
// we have an error, could be *any* value so we use length check | |
if (arguments.length === 2) { | |
done = true; | |
throw err; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// will keep calling the function and yield the value | |
function* guard() { | |
var fn = yield undefined; | |
while (true) { | |
try { | |
fn = yield fn(); | |
} | |
catch (e) { | |
fn = function () { | |
return undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function* SerialStream() { | |
var queued = []; | |
var ended = false; | |
function* pipe() { | |
while (!ended) { | |
if (queued.length === 0) { | |
throw new Error("No streams queued"); | |
} | |
else { | |
ended = yield* queued.shift(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
button { | |
color: red; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// goto: localhost:9090/ | |
// use step through and a break point to see the names | |
var original = '(function () {var aloha=1;})()'; | |
var generated = original.replace(/aloha/g, 'hello'); | |
var map = new (require('./').SourceMapGenerator)({ | |
file: "source-mapped.js" | |
}); | |
var position = {line: 1, column: original.indexOf('aloha')+1}; | |
map.addMapping({ | |
generated: position, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usage: node this-file.js file-to-read | |
stream=require('fs').createReadStream(process.argv[2]); | |
var to_read = 315208358; | |
var max_chunk = Math.pow(2,17); | |
var largest_chunk = 0; | |
var total_read = 0; | |
stream.on('readable', function () { | |
console.log('readable') | |
var b=stream.read(Math.min(max_chunk, to_read - total_read)) | |
while(b != null && to_read) { |