Skip to content

Instantly share code, notes, and snippets.

View vsemozhetbyt's full-sized avatar

Vse Mozhe Buty vsemozhetbyt

View GitHub Profile
@vsemozhetbyt
vsemozhetbyt / benchmark-cycles-var-let-const.js
Last active January 25, 2017 13:33
Benchmark cycles: var / let / const
/******************************************************************************/
'use strict';
/******************************************************************************/
// via https://twitter.com/bmeurer/status/821804688454680576
console.log(`
// v8 ${process.versions.v8} (Node.js ${process.versions.node})
`);
function forVar_______(a) {
@vsemozhetbyt
vsemozhetbyt / benchmark-cycles-var.js
Last active January 19, 2017 17:03
Benchmark cycles (var)
/******************************************************************************/
'use strict';
/******************************************************************************/
// via https://twitter.com/bmeurer/status/821804688454680576
console.log(`
// v8 ${process.versions.v8} (Node.js ${process.versions.node})
`);
function f1(a) {
@vsemozhetbyt
vsemozhetbyt / benchmark-cycles.js
Last active January 19, 2017 02:22
Benchmark cycles
/******************************************************************************/
'use strict';
/******************************************************************************/
// via https://twitter.com/bmeurer/status/821804688454680576
console.log(`
// v8 ${process.versions.v8} (Node.js ${process.versions.node})
`);
function f1(a) {
@vsemozhetbyt
vsemozhetbyt / md.extract-js.js
Last active January 17, 2017 21:56
Extract JavaScript fragments from a markdown file
'use strict';
const fs = require('fs');
const path = require('path');
const rl = require('readline');
const [, , mdFilePath] = process.argv;
const jsDirPath = path.join(
path.dirname(mdFilePath),
@vsemozhetbyt
vsemozhetbyt / gist:3af80b8697d7e8419e1019d04a44ca14
Created November 25, 2016 03:37
Test Node.js buffer zeroing scheme: new-buffer.log vs alloc-unsafe.log
105: 72 73 74 80 81 82 83 84 88 89 90 96 97 98 112 120
* 106: 72 73 74 80 81 82 83 84 88 89 90 96 97 98 107 112 120
* 107: 72 73 74 80 81 82 83 84 88 89 90 96 97 98 112 120
113: 64 65 66 72 73 74 75 76 80 81 82 88 89 90 104 112 120 121 122
121: 56 57 58 64 65 66 67 68 72 73 74 80 81 82 96 104 112 113 114
* 122: 56 57 58 64 65 66 67 68 72 73 74 80 81 82 91 96 104 112 113 114
* 124: 56 57 58 64 65 66 67 68 72 73 74 80 81 82 96 104 112 113 114
* 125: 56 57 58 64 65 66 67 68 72 73 74 80 81 82 91 96 104 112 113 114
* 126: 56 57 58 64 65 66 67 68 72 73 74 80 81 82 96 104 112 113 114
* 127: 56 57 58 64 65 66 67 68 72 73 74 80 81 82 91 96 104 112 113 114
@vsemozhetbyt
vsemozhetbyt / testbufzero.js
Created November 25, 2016 03:30
Test Node.js buffer zeroing scheme
/******************************************************************************/
'use strict';
/******************************************************************************/
const fs = require('fs');
const cp = require('child_process');
const rl = require('readline');
/******************************************************************************/
const bufSize = 128;
const fileSizeLimit = 256;
@vsemozhetbyt
vsemozhetbyt / nomenclature.jsdom.2.js
Created October 5, 2016 21:54
nomenclature.jsdom.js (env variant)
/******************************************************************************/
'use strict';
/******************************************************************************/
const jsdom = require('jsdom');
jsdom.defaultDocumentFeatures = {
FetchExternalResources: false,
ProcessExternalResources: false
};
const window = jsdom.jsdom('').defaultView;
@vsemozhetbyt
vsemozhetbyt / js.nomenclature.jsdom.2.terms.txt
Created October 5, 2016 21:32
jsdom 9.6.0 (2016-10-05) (terms) (env variant)
__stopAllTimers
__timers
_actAsIfLocationReloadCalled
_activeNodeIterators
_activeNodeIteratorsMax
_adoptNodes
_agentOptions
_appendCommentNode
_appendElement
_attached
@vsemozhetbyt
vsemozhetbyt / js.nomenclature.jsdom.2.chains.txt
Created October 5, 2016 21:31
jsdom 9.6.0 (2016-10-05) (chains) (env variant)
window
window["__stopAllTimers"]
window["__stopAllTimers"]["length"]
window["__stopAllTimers"]["name"]
window["__timers"]
window["_core"]
window["_core"]["Attr"]
window["_core"]["Blob"]
window["_core"]["CharacterData"]
window["_core"]["Comment"]
@vsemozhetbyt
vsemozhetbyt / js.nomenclature.jsdom.chains.txt
Created October 5, 2016 20:28
jsdom 9.6.0 (2016-10-05) (chains)
window
window["__stopAllTimers"]
window["__timers"]
window["_core"]
window["_core"]["Attr"]
window["_core"]["Attr"]["length"]
window["_core"]["Attr"]["name"]
window["_core"]["Attr"]["prototype"]
window["_core"]["Attr"]["prototype"]["constructor"]
window["_core"]["Attr"]["prototype"]["localName"]