Skip to content

Instantly share code, notes, and snippets.

Mátyás Fodor matyasfodor

Block or report user

Report or block matyasfodor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ziplongZipshort.ts
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;
}
@matyasfodor
matyasfodor / assign_vs_reduce.js
Created Oct 9, 2018
Performance test for assign vs reduce
View assign_vs_reduce.js
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) =>
View netflixSubsOnTop.js
// ==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 / fb-apps-remover.js
Created Apr 6, 2018
These are the commands I used to remove the apps added to my facebook. I didn't have time to wrap it up, so use it as an inspiration, but It's likely that it won't work as it is.
View fb-apps-remover.js
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.src = "//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js";
head.appendChild(script);
var a = $('span.rfloat');
@matyasfodor
matyasfodor / sortSoAnswers.js
Created Mar 22, 2018
Tampermonkey script that sorts SO answers in descending order by vote count. The accepted answer is the first one.
View sortSoAnswers.js
// ==UserScript==
// @name Sort Answers
// @namespace TBD
// @version 1.0.0.1
// @description sorts SO answers in descending order by vote count. The accepted answer is the first one.
// @author matyasfodor
// @include /https?:\/\/(meta\.)?stackoverflow\.com/questions/.*/
// @grant none
// ==/UserScript==
/* jshint -W097 */
View trello.Tampermonkey.js
// ==UserScript==
// @name Trello TODO list
// @namespace Trello
// @version 0.1
// @description Fit 5 columns into a 13" Macbook screen
// @author Matyas Fodor
// @match https://trello.com/*
// @grant none
// ==/UserScript==
View pairWise.js
const sizedArray = (n) => Array(n).fill();
const times = (n, cb) => {
while (0 < n--) {
cb();
}
}
const fillWithCb = (n, cb) => sizedArray(n).map(cb);
@matyasfodor
matyasfodor / perfTest_forEach_vs_Map.js
Created Jan 31, 2018
Comparison of forEach and map
View perfTest_forEach_vs_Map.js
function arr(n) {
return Array(n+1).join(1).split('');
}
const a = arr(1000000)
a[100] = 2
a[1000] = 2
a[10000] = 2
@matyasfodor
matyasfodor / zip.js
Last active Sep 24, 2018
ES6 Zip functions: zipShort and zipLong
View zip.js
function _zip(func, args) {
const iterators = args.map(arr => arr[Symbol.iterator]());
let iterateInstances = iterators.map((i) => i.next());
ret = []
while(iterateInstances[func](it => !it.done)) {
ret.push(iterateInstances.map(it => it.value));
iterateInstances = iterators.map((i) => i.next());
}
return ret;
}
View LICENSE
MIT License
Copyright (c) 2017 Mátyás Fodor
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
You can’t perform that action at this time.