Last active
December 14, 2018 21:28
-
-
Save brito/ce9070e809bd146d2dfc4b79e51bdf56 to your computer and use it in GitHub Desktop.
for browser console funsies
This file contains hidden or 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
/** in an era of public availability of source code, is explicit credit still necessary? */ | |
//codegolf.stackexchange.com/a/79490/69502 | |
continuous_fraction = f = (n,d) => n%d ? [r=(n/d)|0,...f(d,n-r*d)] : [n/d] | |
fill = (ch,n) => Array(n).fill(ch).join('') | |
bars = n => console.debug(fill('|', Math.abs(n)), n, fill(' ', Math.pow(Math.random(),-2)|0)) | |
interval = | |
setInterval(() => | |
requestAnimationFrame(() => { | |
now = new Date | |
a = ~now | |
b = ~~now | |
indices = continuous_fraction(+now, b) | |
// console.log(+now, b, a, b+a, indices) | |
indices.slice(1).forEach(bars) | |
}) | |
, 10) | |
max = 20 | |
cheapo_limiter = | |
setInterval(() => !--max ? | |
[interval, cheapo_limiter] | |
.map(clearInterval) : 0, 1e3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment