Permalink
Newer
Older
100644 38 lines (34 sloc) 1.18 KB
Feb 26, 2009
1
%w(rubygems sinatra).each {|l| require l}
Feb 26, 2009
2
load "./lib/haml/lib/haml.rb"
Feb 26, 2009
3
Feb 26, 2009
4
configure :production do
5
end
6
Jan 16, 2009
7
get "/" do
8
@magic = 1234567890
9
haml :index, :layout => !request.xhr? ? :layout : false
10
end
11
use_in_file_templates!
12
__END__
13
@@ layout
14
!!!Strict
15
%html
16
%head
17
%title= "Is UNIX time >= #{@magic}?"
18
%style * {font-family: 'Lucida Grande', Helvetica, sans-serif;padding:10px;margin:0px;text-align:center;} h2 {font-size:300px;}
19
%script{:src=>"http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"}
Jan 16, 2009
20
%script $(getTime); function getTime() { $("body").load("/");setTimeout(getTime,1000);};
Feb 26, 2009
21
%script
22
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
23
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
24
%script
25
try {
26
var pageTracker = _gat._getTracker("UA-658908-9");
27
pageTracker._trackPageview();
28
} catch(err) {}
Jan 16, 2009
29
%body
30
= yield
31
@@ index
32
%h1= "Is UNIX time >= #{@magic}?"
33
%div#time
34
%h2= (Time.now.to_i >= @magic) ? "YES" : "NO"
35
-if !(Time.now.to_i >= @magic)
36
%h3= "~#{@magic - Time.now.to_i} seconds 'til #{@magic}"
37