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
async function* asyncAnimationFrame () { | |
const h = {} | |
h.promise = new Promise(r => h.resolve = r) | |
h.flipFrame = () => { | |
h.resolve() | |
h.promise = new Promise(r => h.resolve = r) | |
} | |
try { | |
while (true) { | |
h.idAF = requestAnimationFrame(h.flipFrame) |
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 filterOutliers(someArray) { | |
if(someArray.length < 4) | |
return someArray; | |
let values, q1, q3, iqr, maxValue, minValue; | |
values = someArray.slice().sort( (a, b) => a - b);//copy array fast and sort | |
if((values.length / 4) % 1 === 0){//find quartiles |
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
// http://michalbe.blogspot.com.br/2013/03/javascript-less-known-parts-bitwise.html | |
// http://jsperf.com/bitwise-vs-math-object | |
// http://united-coders.com/christian-harms/results-for-game-for-forfeits-and-the-winner-is/ | |
// https://mudcu.be/journal/2011/11/bitwise-gems-and-other-optimizations/ | |
// https://dreaminginjavascript.wordpress.com/2009/02/09/bitwise-byte-foolish/ | |
// http://jsperf.com/math-min-max-vs-ternary-vs-if/24 | |
"use strict"; | |
var PI = Math.PI; |