Skip to content

Instantly share code, notes, and snippets.

@matthieuprat
Last active January 22, 2016 08:10
Show Gist options
  • Save matthieuprat/635f238341cba8515393 to your computer and use it in GitHub Desktop.
Save matthieuprat/635f238341cba8515393 to your computer and use it in GitHub Desktop.
Minimal timer
data:text/html,<script>var t = 3605</script><body style="display: flex; align-items: center; justify-content: center; font-family: sans-serif; font-size: 40vh;"><div></div><script>var e = document.getElementsByTagName('div')[0]; var tid = setInterval(() => {e.innerText = [~~(t/3600), ~~(t/60) % 60, t % 60].reduce((a, t) => ((a.length || t) && a.push(t), a), []).map(t => ('0' + t).slice(-2)).join(':') || '00'; --t < 0 && clearInterval(tid)}, 1000)</script></body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment