Skip to content

Instantly share code, notes, and snippets.

@brito
Last active December 14, 2018 21:28
Show Gist options
  • Save brito/ce9070e809bd146d2dfc4b79e51bdf56 to your computer and use it in GitHub Desktop.
Save brito/ce9070e809bd146d2dfc4b79e51bdf56 to your computer and use it in GitHub Desktop.
for browser console funsies
/** 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