made with esnextbin
This file contains hidden or 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
| LMDV-BRADLEY:flowdoc bfarias$ flow check | |
| lib/index.js:4 | |
| 4: import {parse} from 'babylon'; | |
| ^^^^^^^^^ babylon. Required module not found | |
| node_modules/babylon/index.js:77 | |
| 77: function getOptions(opts /*:: ?: Object*/) /*: Object*/ { | |
| ^ Type annotations are not allowed in untyped mode |
This file contains hidden or 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
| // what does | |
| yield: ({*yield(){yield yield;}}.yield((yield) => yield)); | |
| // mean? | |
| // the key is that in sloppy mode "yield" is not a reserved word | |
| // this is shown in the spec with [~yield] on grammar rules | |
| yield: | |
| // make a labelled statement (the statement that follows gets this label) | |
| // completely useless unless the next statement is an iteration statement (loop) |
This file contains hidden or 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
| #!/usr/bin/env node | |
| // usage: node globals.js $FILE_TO_FIND_GLOBALS | |
| var fs = require('fs'); | |
| var src = fs.readFileSync(process.argv[2]).toString(); | |
| //src = 'function foo() {foo()}' | |
| var esprima = require('esprima'); | |
| var globals = new Set(); |
This file contains hidden or 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
| import fs from "fs"; | |
| import path from "path"; | |
| const readFileRange = (file, start, stop) => { | |
| const fd = fs.openSync(file, 'r'); | |
| let length = stop - start; | |
| let read = 0; | |
| const buf = new Buffer(length); | |
| while (read !== length) { | |
| read += fs.readSync(fd, buf, read, length - read, start + read); |
This file contains hidden or 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
| "use strict"; | |
| // | |
| // node find-retained_size.js ./path/to/snapshot.json | |
| // | |
| import {HeapSnapshot,JSONSnapshotProvider} from '../'; | |
| import {resolve} from 'path'; | |
| const file = resolve(process.argv[2]); |
This file contains hidden or 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
| [0] 12:06 PM bradleymeck node $ cat ../my-app/package.json | |
| { | |
| "name": "my-app", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "server.js", | |
| "scripts": { | |
| "build": "browserify --bare --standalone my-app server.js -o _third_party_main.js", | |
| "start": "node server.js" | |
| }, |
This file contains hidden or 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
| #! iojs --expose-gc $mode | |
| // creates 10e3 maps with 10 elements each | |
| // runs 10e3 gc() after | |
| // modes: ["m", "w"] | |
| // m: use a normal map | |
| // w: use a weak map | |
| var maps; | |
| function create_maps(c, n) { | |
| maps = []; | |
| for (var m = 0; m < c; m++) { |
This file contains hidden or 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 toTrees(log, heapsnapshot) { | |
| var nodes = Object.create(null); | |
| var node_fields = heapsnapshot.snapshot.meta.node_fields; | |
| var node_types = heapsnapshot.snapshot.meta.node_types; | |
| var edge_fields = heapsnapshot.snapshot.meta.edge_fields; | |
| var edge_types = heapsnapshot.snapshot.meta.edge_types; | |
| var nodes_arr = []; | |
| var edges = []; | |
| for (var i = 0; i < heapsnapshot.nodes.length; i+= node_fields.length) { | |
| var _node = Object.create(null); |
This file contains hidden or 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 f() { | |
| // put const here to make sure no teammate accidentally changes the ref | |
| const needs_to_stay_same_ref = {}; | |
| // something like a setInterval to check on the status of an object | |
| persistently_cached_arg_fn(needs_to_stay_same_ref); | |
| // expose something the outside world could change | |
| return needs_to_stay_same_ref; | |
| } |