Skip to content

Instantly share code, notes, and snippets.

View dawnerd's full-sized avatar
🌮

Troy Whiteley dawnerd

🌮
View GitHub Profile
@dawnerd
dawnerd / Super short countdown.js
Last active September 24, 2015 05:57
Shortest countdown function ever.
setInterval(function() {
console.log([s = [86400000, 3600000, 60000, 1000]][0].map(function(t) {
return ("0" + [(t===s[0] && (remaining = (future - ~~(+new Date()/1000))*1000)), left = ~~(remaining/t), remaining -= left*t][1]).slice(-2);
}).join(':'));
}, [1000, future = +new Date()/1000 + 100000][0]);