Skip to content

Instantly share code, notes, and snippets.

View vsemozhetbyt's full-sized avatar

Vse Mozhe Buty vsemozhetbyt

View GitHub Profile
'use strict';
/******************************************************************************/
console.log('Requiring modules...');
const fs = require('fs');
const path = require('path');
const readline = require('readline');
const execSync = require('child_process').execFileSync;
const urlParser = require('url');
const jsdom = require('jsdom');
[enforcing Ignition and TurboFan for ObjectConstructor because: Super reference
[enforcing Ignition and TurboFan for Uint8ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Int8ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Uint16ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Int16ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Uint32ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Int32ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Float32ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Float64ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Uint8ClampedArrayConstructor because: Super reference
@vsemozhetbyt
vsemozhetbyt / flagged-re-tag.js
Created July 21, 2017 23:51
RegExp tag function with flags
'use strict';
function re(strings, ...expressions) {
const pattern = expressions.reduce(
(acc, expr, i) => `${acc}${expr}${strings[i + 1]}`, strings[0]
);
return ([flags]) => new RegExp(pattern, flags);
}
console.log(re`^abc$``gu`);
'use strict';
const fs = require('fs');
const readline = require('readline');
const files = [];
const [, , target = '.'] = process.argv;
if (fs.statSync(target).isDirectory()) {
files.push(...fs.readdirSync(target)
.map(file => `${target}/${file}`)
'use strict';
const { writeFileSync } = require('fs');
const LAST_CODE_POINT = 0x10FFFF;
const RegExps = [/./u, /^(?!.)/, /\w/u, /\W/u, /\d/u, /\D/u, /\s/u, /\S/u, /\b/u, /\B/u];
let codePoint = 0;
let str;
let data = '';
@vsemozhetbyt
vsemozhetbyt / node-check-collaborators.js
Last active May 11, 2017 15:07
Check if comment authors in PRs are Node.js collaborators
javascript: {
getCollaboratorsUsernames();
function getCollaboratorsUsernames() {
const xhr = new XMLHttpRequest();
xhr.open('GET', 'https://github.com/nodejs/node/blob/master/README.md', true);
xhr.responseType = 'document';
xhr.withCredentials = true;
xhr.onload = markAuthorsLinks;
xhr.ontimeout = xhr.onerror = (evt) => { console.log(evt); };
@vsemozhetbyt
vsemozhetbyt / node-tests-cwd.js
Last active May 3, 2017 15:32
Find cwd-dependent Node.js tests
/******************************************************************************/
'use strict';
/******************************************************************************/
const cp = require('child_process');
const fs = require('fs');
const path = require('path');
/******************************************************************************/
const rootPath = 'j:/temp/node-master';
const nodePath = `${rootPath}/Release/node.exe`;
const overPath = path.resolve(rootPath, '..');
/******************************************************************************/
'use strict';
/******************************************************************************/
const [, , fpath] = process.argv;
if (!fpath) {
console.error('Add the file path, please.');
process.exit(1);
}
/******************************************************************************/
const fs = require('fs');
const Word = 'Word'; // In the beginning was the Word,
const God = {
get [Word]() { // and the Word was with God,
return this; // and the Word was God.
},
};
console.log(God.Word === God); // The same was in the beginning with God.
/******************************************************************************/
'use strict';
/******************************************************************************/
const path = require('path');
const fpath = process.argv[2] || '';
const fext = path.extname(fpath);
if (!fpath || process.argv[3] || !['.gls', '.ifo'].includes(fext)) {
const scriptName = path.basename(__filename);