Skip to content

Instantly share code, notes, and snippets.

@jrockway
Created March 9, 2010 14:34
Show Gist options
  • Select an option

  • Save jrockway/326637 to your computer and use it in GitHub Desktop.

Select an option

Save jrockway/326637 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use feature ':5.10';
use URI::Escape;
sub xx {
uri_unescape(
join '',
map { chr (ord($_) - 1) }
split //, uri_unescape($_[0]),
);
}
while (<>){
s/^xx\('(.+)'\);/$1/;
say xx($1);
}
<script type="text/javascript">
function startClock() {
timeRemaining();
}
function string(number) {
var tempnum;
tempnum= Math.round(number)+" ";
tempnum= tempnum.substring(0,tempnum.length-1);
if (tempnum.length >3) {
tempnum = tempnum.substring(0,tempnum.length-3) + "," + tempnum.substring(tempnum.length-3, 99);
}
if (tempnum.length >7) {
tempnum = tempnum.substring(0,tempnum.length-7) + "," + tempnum.substring(tempnum.length-7, 99);
}
if (tempnum.length >11) {
tempnum = tempnum.substring(0,tempnum.length-11) + "," + tempnum.substring(tempnum.length-11, 99);
}
if (tempnum.length == 11) {
tempnum = " " + tempnum;
}
if (tempnum.length == 10) {
tempnum = " " + tempnum;
}
if (tempnum.length == 9) {
tempnum = " " + tempnum;
}
if (tempnum.length == 7) {
tempnum = " " + tempnum;
}
if (tempnum.length == 6) {
tempnum = " " + tempnum;
}
if (tempnum.length == 5) {
tempnum = " " + tempnum;
}
if (tempnum.length == 3) {
tempnum = " " + tempnum;
}
if (tempnum.length == 2) {
tempnum = " " + tempnum;
}
if (tempnum.length == 1) {
tempnum = " " + tempnum;
}
return tempnum;
}
function timeRemaining() {
var now = new Date();
var newyears = new Date("January 1, 2000");
var todaysdate = new Date("January 1, 2000");
var may4 = new Date("May 4, 1999");
var ye = new Date("Dec 31, 2009");
var currentPop;
var BirthsInYear;
newyears.setFullYear(now.getFullYear());
secsSince = Math.round(now.getTime() - newyears.getTime())/1000;
secsSincePop = Math.round(now.getTime() - may4.getTime())/1000;
secsSinceYearEnd = Math.round(now.getTime() - ye.getTime())/1000;
todaysdate.setMonth(now.getMonth());
todaysdate.setDate(now.getDate());
todaysdate.setFullYear(now.getFullYear());
secsToday = (now.getTime()-todaysdate.getTime())/1000;
// test to see what page is loaded, then activate the appropriate realtimestatistics
// NOTE: if you startup more than 20, they go to slow
switch (document.title) {
case 'Real Time Statistics Project':
{
google_searches = string((secsToday) * 35112);
document.realtimestatistics.elements["google_searches"].value = google_searches;
break;
}
}
timerID = setTimeout("timeRemaining()", 1);
timerRunning = true;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment