Last active
December 20, 2015 04:38
-
-
Save Cycymomo/6071804 to your computer and use it in GitHub Desktop.
140bytes - smallest countdown ever http://www.developpez.net/forums/d1362763/webmasters-developpement-web/javascript/ludique-defis-code-en-tweet/
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
// 140bytes - http://www.developpez.net/forums/d1362763/webmasters-developpement-web/javascript/ludique-defis-code-en-tweet/ | |
/* smaller ... but global leak :p */ | |
(function(d,p){ | |
x=d,y=p,setInterval("t=(x-new Date)/6e4;y(~~(t/1440)+'j '+~~(t/60)%24+'h '+~~t%60+'m '+~~(t*60)%60+'s')",1e3) | |
})(new Date(+new Date()+1728e5),function(msg){console.log(msg);}); | |
/* Outputs | |
1j 23h 59m 59s | |
1j 23h 59m 58s | |
1j 23h 59m 57s | |
1j 23h 59m 56s | |
1j 23h 59m 55s | |
... etc ... | |
*/ |
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
// 140bytes - http://www.developpez.net/forums/d1362763/webmasters-developpement-web/javascript/ludique-defis-code-en-tweet/ | |
/* ... than this without global leak */ | |
(function(d,p){ | |
setInterval(function(){t=(d-new Date)/6e4;p(~~(t/1440)+'j '+~~(t/60)%24+'h '+~~t%60+'m '+~~(t*60)%60+'s')},1e3) | |
})(new Date(+new Date()+1728e5),function(msg){console.log(msg);}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment