This file contains 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
var i=0; | |
setInterval(()=>console.log(i),1000); | |
var a=[]; | |
setInterval(function abc(){i++;a.push([Date.now()])},0); | |
// replace next line with worker | |
//setInterval(function abc(){i++;a[a.length-1].push(Date.now())},0); | |
///// | |
function abcdef() { |
This file contains 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
// scroll to id tagged element when there is a fixed sized header bar | |
function executeDelayed(f,...args){ | |
Promise.resolve().then(function(){ | |
window.requestAnimationFrame(function(){ | |
f.call(this,...args); | |
}); | |
}); | |
} | |
var queue=[]; | |
window.addEventListener(/*"DOMContentLoaded"*/"load", processQueue); |
This file contains 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 loadScript(script,...args){ | |
if (document.readyState === 'complete' || document.readyState === 'interactive') { | |
script(...args); | |
}else{ | |
document.addEventListener('DOMContentLoaded',script.bind(this,...args)); | |
} | |
} |
This file contains 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 transpose(matrix){ | |
var n=matrix.length; | |
var m=matrix[0].length; | |
var result=new Array(m); | |
for(var i=0;i<m;i++){ | |
result[i]=new Array(n); | |
for(var j=0;j<n;j++){ | |
result[i][j]=matrix[j][i]; | |
} | |
} |
This file contains 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
var [debounceAnimation,removeDebounceAnimation]=(function(){ | |
var id=1; | |
var registeredFunctions=new Map(); | |
var registeredFunctionIds=new Map(); | |
var isLooping=false; | |
function debounceAnimationLoop(){ | |
// iterate over registeredFunctions | |
var entriesIterator=registeredFunctions.entries(); | |
var entry; | |
while(!(entry=entriesIterator.next()).done){ |
This file contains 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 loadElementsSecure(query,root,timeout){ | |
if(timeout===undefined){ | |
timeout=10000; | |
} | |
if(root===undefined){ | |
root=document; | |
} | |
var t0=Date.now(); | |
return new Promise(function(resolve,reject){ | |
function _loadElements(){ |
This file contains 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
fastboot boot twrp-3.5.2_9-0-jasmine_sprout.img | |
adb reboot bootloader | |
fastboot flashing unlock | |
# adb boot into fastboot: | |
adb reboot bootloader | |
fastboot flash recovery twrp.img | |
# if error: FAILED (remote: '(recovery_b) No such partition') |
This file contains 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
// https://arh.antoinevastel.com/reports/stats/menu.html | |
// https://news.ycombinator.com/item?id=20479015 | |
// https://github.com/JonasCz/How-To-Prevent-Scraping | |
// https://dzone.com/articles/5-puppeteer-tricks-that-will-make-your-web-scrapin | |
// https://github.com/infosimples/detect-headless | |
// https://antoinevastel.com/bot%20detection/2018/01/17/detect-chrome-headless-v2.html | |
// https://webscraping.pro/headless-chrome-detection-and-anti-detection/ | |
// https://stackoverflow.com/questions/55364643/headless-browser-detection | |
// https://github.com/infosimples/detect-headless | |
// https://bot.incolumitas.com/ |
This file contains 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
https://stackoverflow.com/questions/48011613/rendering-webgl-image-in-headless-chrome-without-a-gpu | |
(function(){ | |
var __getContext=HTMLCanvasElement.prototype.getContext; | |
Object.defineProperty(HTMLCanvasElement.prototype,'getContext',{ | |
configurable: true, | |
enumerable: true, | |
value: function getContext(contextType, contextAttributes={}){ | |
var options={ | |
premultipliedAlpha: false | |
} |
This file contains 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 isObject(o){return typeof o === "object" && o !==null} | |
function generatePatch(classNames){ | |
var result=''; | |
for(var className of classNames){ | |
// CookieStore | |
var classPatch=''; | |
if(className in window){ | |
classPatch+=`function ${className}(){}\n`; | |
var classPrototype=window[className].prototype; | |
var descriptors=Object.getOwnPropertyDescriptors(classPrototype); |