The extra app updates with the time. The JS submission is 118 bytes (96 if you dont care about leaking globals) and the app is 234 bytes.
-
-
Save eligrey/985721 to your computer and use it in GitHub Desktop.
Analog clock of the current time.
This file contains 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
function (h /*int hours*/, n /*Date now*/) { | |
// Clock face characters are U+1F550 to U+1F567, so a surrogate pair must be used | |
// due to JavaScript being UTF-16 | |
return String.fromCharCode(55357, | |
56656 + ( | |
(h = (n = new Date).getHours() % 12) ? h - 1 : 11 // offset by hour | |
) + (n.getMinutes() > 29 && 12) // offset by 12 if past or at 30 mins | |
); | |
} |
This file contains 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
<x id=c><script>setInterval(eval(a="c.innerHTML='&#'+(128336+((h=(n=new Date).getHours(c.style.fontSize=Math.min(innerWidth,innerHeight)+'px')%12)?h-1:11)+(n.getMinutes()>29&&12)),a"),1e3)</script> |
This file contains 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
function(h,n){return String.fromCharCode(55357,56656+((h=(n=new Date).getHours()%12)?h-1:11)+(n.getMinutes()>29&&12))} |
Public domain. No warranty expressed or implied. Use at your own risk. Attribution to Eli Grey is encouraged but optional.
This file contains 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
{ | |
"name": "analog-clock" | |
, "description": "Analog clock of the current time" | |
, "keywords": ["unicode", "time", "clock"] | |
} |
Install a font like Symbola and try again.
hmmm. personally, and this is just me, i think you should find a more reliable way to render it.
The submission isn't about rendering anything though. It's just about getting the current clock face character.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hmmm, doesn't seem to work for me in FF4 or chrome or safari on OS X... ideas?