Last active
October 3, 2020 00:50
-
-
Save forrest-akin/05581e05acb34f03d0f2253b040e73ac to your computer and use it in GitHub Desktop.
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
class RecentCounter { ping = ping( [] , 0 ) } | |
const ping = ( pings , ndx ) => t => { | |
const min = t - 3000 | |
while ( pings[ ndx ] < min ) ndx++ | |
return pings.push( t ) - ndx | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment