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"; | |
const boxes = new WeakMap; | |
function Boxes() { | |
if (!new.target) { | |
return new Boxes; | |
} | |
boxes.set(Object.freeze(this), Object.seal({ | |
list: [] | |
})); |
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* shrinkGen(s) { | |
let i = -1, c; | |
while (c = s.charCodeAt(++i)) yield c << 0 | (s.charCodeAt(++i) || 0) << 8; | |
} | |
function shrink(input) { | |
return String.fromCodePoint(...shrinkGen(input)); | |
} | |
function* expandGen(str) { |
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
Please read my first comment before drawing your own conclusion and take the points stated there into consideration as well | |
-------------------------------------------------------------------------------- | |
Object iteration test in node 12.2.0, v8 7.4.288.21-node.17 | |
Let O be object with properties x = 1, y = 1, z = 1, then iterate over the values and sum them, storing the result in variable `total` | |
-------------------------------------------------------------------------------- | |
O = { x: 1, y: 1, z: 1 } |
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
// guard against circular properties built in | |
function flatten(array) { | |
const { isArray } = Array; | |
if (!isArray(array)) { | |
return []; | |
} | |
const visited = new WeakSet; | |
const result = []; | |
const stack = [array]; |
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"; | |
const { isArray } = Array | |
const { abs, atan2, round, sqrt, cos, sin } = Math; | |
function num(n, d) { | |
return n !== undefined ? Number(n) : d; | |
} | |
function parseArgs(x, y, z) { | |
if (typeof x === "object" && x !== 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
import { Server } from "_http_server"; | |
const Aya = class Aya { | |
constructor() { | |
this.routes = { | |
GET: [], | |
HEAD: [], | |
POST: [], | |
PUT: [], |
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
export function format(f) { | |
const argsLen = arguments.length; | |
if (argsLen < 2) return f; | |
const fLen = f.length - 1; | |
let str = ""; | |
let a = 2; | |
let lastPos = 0; | |
let tempStr; | |
for (let i = 0; i < fLen; ++i) { |
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
// ==UserScript== | |
// @id fix-old-youtube-layout | |
// @name Fix old Youtube layout (2018.08.17.) | |
// @version 1 | |
// @namespace intermission | |
// @author intermission | |
// @description Fixes old Youtube layout (2018.08.17.) | |
// @match https://www.youtube.com | |
// @match https://www.youtube.com/* | |
// @run-at document-start |
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() { | |
"use strict"; | |
var InvalidStateError, NetworkError, ProgressEvent, SecurityError, SyntaxError, XMLHttpRequest, XMLHttpRequestEventTarget, XMLHttpRequestUpload, http, https, os, url, extend, format, g; | |
g = ( | |
typeof global !== "undefined" ? | |
global : | |
typeof self !== "undefined" ? | |
self : | |
typeof window !== "undefined" ? |
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"; | |
var pow = Math.pow, | |
floor = Math.floor, | |
powArray = Array(54).map(function(_, i) { return pow(2, i); }); | |
function intersection53() { | |
var map, key, i, j, len, mask, arr, value, n1, n2, b, r, argsLen, result; | |
for (map = {}, i = 0, argsLen = arguments.length; i < argsLen; ++i) { |