Skip to content

Instantly share code, notes, and snippets.

View matyasfodor's full-sized avatar
🦕

Mátyás Fodor matyasfodor

🦕
  • BenevolentAI
  • London
View GitHub Profile
// ==UserScript==
// @name Netflix Subtitles On Top
// @namespace https://www.netflix.com/
// @version 0.1
// @description places the subs to the top of the screen
// @author @matyasfodor
// @match https://www.netflix.com/*
// @grant GM_addStyle
// ==/UserScript==
@matyasfodor
matyasfodor / assign_vs_reduce.js
Created October 9, 2018 11:31
Performance test for assign vs reduce
const randString = () => Math.random().toString(36).substring(7);
const gen = (n) =>
new Array(n).fill(1).map(() => ({key: randString(), value: Math.random()}));
const array1 = gen(100);
const array2 = gen(1000);
const array3 = gen(100000);
const assign = (arr) =>
const _zip = <T>(func: IArrayMethodSignature<IteratorResult<T>>, args: T[][]) => {
const iterators = args.map(arr => arr[Symbol.iterator]());
let iterateInstances = iterators.map((i) => i.next());
const ret: T[][] = [];
while (func.bind(iterateInstances, ((it: IteratorResult<T>) => !it.done))) {
ret.push(iterateInstances.map(it => it.value));
iterateInstances = iterators.map((i) => i.next());
}
return ret;
}