Skip to content

Instantly share code, notes, and snippets.

@forrest-akin
Last active October 3, 2020 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save forrest-akin/05581e05acb34f03d0f2253b040e73ac to your computer and use it in GitHub Desktop.
Save forrest-akin/05581e05acb34f03d0f2253b040e73ac to your computer and use it in GitHub Desktop.
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