Created
December 10, 2012 23:41
-
-
Save rafbm/4254381 to your computer and use it in GitHub Desktop.
Little hack for using readable MM:SS time values in CoffeeScript
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
Number::m = (seconds = 0) -> | |
this * 60 + seconds | |
markers = [ | |
0.m 36 | |
1.m 14 | |
1.m 48 | |
2.m 23 | |
2.m 56 | |
3.m 30 | |
4.m 7 | |
] | |
# markers => [ 36, 74, 108, 143, 176, 210, 247 ] |
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
// Generated by CoffeeScript 1.4.0 | |
var markers; | |
Number.prototype.m = function(seconds) { | |
if (seconds == null) { | |
seconds = 0; | |
} | |
return this * 60 + seconds; | |
}; | |
markers = [0..m(36), 1..m(14), 1..m(48), 2..m(23), 2..m(56), 3..m(30), 4..m(7)]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment