Skip to content

Instantly share code, notes, and snippets.

'use strict';
function onLoad() {
cfg.load();
const prefix = 'div.' + webm.getStyle('cozyMessage') + ' ';
const q = Object.values(sites).flatMap(({ patterns: p }) => p.map(x => 'a[href*="' + x +'"]'));
q.push('a[href*="//t.co/"]');
links.query = prefix + q.join(',' + prefix);
links.process(d.body);
new MutationObserver(onMutations).observe(d.body, {childList:true, subtree:true});
const languageCache = new Map();
let visitedNodes;
let language;
const resetVisitedNodes = () => {
visitedNodes = new WeakSet();
};
const formatRegex = /\{([^\}]*)\}/gui;
"use strict";
const benchmark = require("benchmark");
const suite = new benchmark.Suite;
/** SETUP BEGIN */
const length = 100;
const value = "";
const arrayOf = (function () {
function* generator(length, fill) {
const limits = [
{ "x<": [90, 8] },
{ "x<": [80, 7.9] },
];
const re = /^x?([<>]=?)$|^([<>]=?)x$/i;
const comparators = {
"<": (a, b) => a < b,
"<=": (a, b) => a <= b,
">": (a, b) => a > b,
@SuppressWarnings("ForLoopReplaceableByForEach")
public final class Sum {
private Sum() {}
public static byte of(byte[] array) {
if (array == null) {
return 0;
}
byte result = 0;
for (int i = 0, length = array.length; i < length; ++i) {
const partialBinder = ((hole, rest) => {
"use strict";
function partiallyBound(fn, args, ...missing) {
const argsLen = args.length;
const missingIter = missing[Symbol.iterator]();
for (let i = 0; i < argsLen; ++i) {
switch (args[i]) {
case hole: break;
case rest: args.splice(i, 1, ...missing); return fn.apply(this, args);
default: continue;
const csvEscape = function() {
const map = {
";": ",",
"\n": "\\n"
};
const replacerRe = /./gsm;
const replacer = x => `\\x${x.charCodeAt(0).toString(16).padStart(2, 0)}`;
const escaped = Object.keys(map).map(x => x.replace(replacerRe, replacer));
const escapeRe = new RegExp(escaped.join("|"), "g");
const escape = x => map[x];
function isLetter(codePoint) {
if (65 <= codePoint && codePoint <= 90) return true;
if (97 <= codePoint && codePoint < 123) return true;
// maybe more cases for unicode
return false;
}
function reverseOnlyLetters(string) {
if (typeof string !== "string") return;
const length = string.length;
function _search(parents, path, child, results, keysToSearch, valuesToSearch) {
for (const [k, { value: v }] of Object.entries(Object.getOwnPropertyDescriptors(child))) {
path[path.length] = String(k);
if (typeof v === "object") {
if (v != null && !parents.has(v)) {
parents.add(v);
try {
_search(parents, path, v, results, keysToSearch, valuesToSearch);
} catch(err) { return console.error("Stack limit reached at: " + path.join(" -> ")); }
}