Created
April 26, 2016 18:00
-
-
Save nvolungis/87346c0481b114b269c1503480c5f810 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
# init | |
accum = [0, 0, ... duration/bucketSize] | |
display = [0, 0, ... duration/bucketSize] | |
#when adding a worm / worm change | |
display = accum.map (viewCount, index) -> | |
return viewCount if index < worm[0], index > worm[1] | |
return viewCount + 1 | |
#when ending a worm | |
worm = [ceil(start/bucketSize), ceil(end/bucketSize)] | |
accum = accum.map (viewCount, index) -> | |
return viewCount if index < worm[0], index > worm[1] | |
return viewCount + 1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment