more copy fixes

This commit is contained in:
Kyle Drake 2014-04-23 15:07:00 -07:00
parent 46e05ccb54
commit 3b0dd09b97
6 changed files with 50 additions and 12 deletions

6
app.rb
View file

@ -71,6 +71,12 @@ get '/stats_mockup' do
end end
get '/?' do get '/?' do
if SimpleCache.expired?(:sites_count)
@sites_count = SimpleCache.store :sites_count, Site.count.roundup(100), 600 # 10 Minutes
else
@sites_count = SimpleCache.get :sites_count
end
erb :index, layout: false erb :index, layout: false
end end

View file

@ -96,3 +96,13 @@ class Sinatra::Base
render_original engine, data, options, locals, &block render_original engine, data, options, locals, &block
end end
end end
class Numeric
def roundup(nearest=10)
self % nearest == 0 ? self : self + nearest - (self % nearest)
end
def rounddown(nearest=10)
self % nearest == 0 ? self : self - (self % nearest)
end
end

25
models/simple_cache.rb Normal file
View file

@ -0,0 +1,25 @@
require 'thread'
require 'time'
module SimpleCache
@cache = {}
@semaphore = Mutex.new
class << self
def store(name, value, timeout=30)
@semaphore.synchronize {
@cache[name] = {value: value, expires_at: Time.now+timeout}
}
value
end
def get(name)
@cache[name][:value]
end
def expired?(name)
return false if @cache[name] && @cache[name][:expires_at] > Time.now
true
end
end
end

View file

@ -3,15 +3,16 @@
<div class="row"> <div class="row">
<p class="tiny col col-60 credits"> <p class="tiny col col-60 credits">
<a href="http://neocities.org" title="Neocities.org">Neocities.org</a> is a <a href="https://github.com/neocities" title="Neocities on GitHub" style="text-decoration: underline">completely open source</a> startup. <a href="https://twitter.com/neocitiesweb" style="text-decoration: underline">Follow us on twitter</a>. <a href="http://neocities.org" title="Neocities.org">Neocities.org</a> is a <a href="https://github.com/neocities" title="Neocities on GitHub" style="text-decoration: underline">completely open source</a> project. <a href="https://twitter.com/neocitiesweb" style="text-decoration: underline">Follow us on twitter</a>.
</p> </p>
<nav class="footer-Nav col col-40"> <nav class="footer-Nav col col-40">
<ul class="tiny h-Nav"> <ul class="tiny h-Nav">
<!-- <li><a href="api" title="Neocities API">API</a></li> --> <li><a href="/blog" title="Neocities API">Blog</a></li>
<li><a href="terms" title="Neocities Terms of Use" rel="nofollow">Terms</a></li> <li><a href="/api" title="Neocities API">API</a></li>
<li><a href="privacy" title="Neocities Privacy Policy" rel="nofollow">Privacy</a></li> <li><a href="/terms" title="Neocities Terms of Use" rel="nofollow">Terms</a></li>
<li><a href="contact" title="Contact Us" rel="nofollow">Contact</a></li> <li><a href="/privacy" title="Neocities Privacy Policy" rel="nofollow">Privacy</a></li>
<li><a href="/contact" title="Contact Us" rel="nofollow">Contact</a></li>
</ul> </ul>
</nav> </nav>
</div> <!-- end .row --> </div> <!-- end .row -->

View file

@ -7,9 +7,6 @@
</a> </a>
<ul class="h-Nav constant-Nav"> <ul class="h-Nav constant-Nav">
<li>
<a href="/" title="Back to the Start">Neocities</a>
</li>
<li> <li>
<a href="/browse" title="Browse Neocities member websites">Websites</a> <a href="/browse" title="Browse Neocities member websites">Websites</a>
</li> </li>

View file

@ -5,7 +5,7 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Neocities.org: Social websites</title> <title>Neocities: Create your free website now!</title>
<meta itemprop="name" content="Neocities.org" /> <meta itemprop="name" content="Neocities.org" />
<meta itemprop="description" content="Create your own free home page, and do whatever you want with it." /> <meta itemprop="description" content="Create your own free home page, and do whatever you want with it." />
<meta name="description" content="Neocities is the new Geocities. Create your own free home page, and do whatever you want with it." /> <meta name="description" content="Neocities is the new Geocities. Create your own free home page, and do whatever you want with it." />
@ -134,10 +134,9 @@
</li> </li>
<li class="intro-Social"> <li class="intro-Social">
<span class="intro-Icon"></span> <span class="intro-Icon"></span>
<h2 class="delta">Social web building</h2> <h2 class="eps">Making the web fun again</h2>
<p class="tiny"> <p class="tiny">
Browse, comment on, and follow the latest changes for any Neocities site! We're community of over <%= @sites_count.to_s.reverse.gsub(/...(?=.)/,'\&,').reverse %> websites that are bringing back creative expression on the web. Anyone can make a site, only your imagination is required. Join us!
</p>
</li> </li>
</ul> </ul>