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]);
@dawnerd
dawnerd / Fibonacci.html
Created November 13, 2010 21:55
Outputs fibonacci numbers in JS
<html>
<head>
<title>fibonacci sequence</title>
</head>
<body>
<p>This will output a ton of numbers and might take a while.</p>
<div id="output"></div>
<script>
var o = '0, 1, ', f = 0, s = 1, n = 1, c = 1000;