Last active
August 29, 2015 14:07
-
-
Save digitarhythm/88bf4ffe31423fbe8c10 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/coffee-script/1.7.1/coffee-script.min.js"></script> | |
<script type="text/coffeescript"> | |
window.onload = -> | |
disp = "<pre>Su Ma Th We Tu Fr Su<br>" | |
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] | |
now = new Date() | |
y = now.getFullYear() | |
m = now.getMonth() | |
d = now.getDate() | |
fd = new Date(y, m, 1, 12, 0, 0, 0) | |
w = fd.getDay() | |
for i in [0...w] | |
disp += " " | |
mday = days[m] | |
if (m == 1) | |
mday += (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) | |
for i in [1..mday] | |
c = if (i < 10) then " " else "" | |
disp += c+i+" " | |
if ((i + w) % 7 == 0) | |
disp += "<br>" | |
disp += "</pre>" | |
element = document.getElementById("calendar") | |
element.innerHTML = disp | |
</script> | |
</head> | |
<body> | |
<div id="calendar"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment