Merge branch 'v2' of github.com:neocities/neocities into v2

This commit is contained in:
Victoria Wang 2014-04-23 15:25:58 -07:00
commit 7cd0fc241a
9 changed files with 59 additions and 20 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,17 @@
<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="/about" title="About Neocities">About</a></li>
<li><a href="terms" title="Neocities Terms of Use" rel="nofollow">Terms</a></li> <li><a href="/blog" title="Neocities Blog">Blog</a></li>
<li><a href="privacy" title="Neocities Privacy Policy" rel="nofollow">Privacy</a></li> <li><a href="/api" title="Neocities API">API</a></li>
<li><a href="contact" title="Contact Us" rel="nofollow">Contact</a></li> <li><a href="/terms" title="Neocities Terms of Use" rel="nofollow">Terms</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

@ -14,7 +14,7 @@
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<article> <article>
<h6>Neocities is bringing back the fun, creativity and free expression that made the web great.</h6> <h1>Neocities is bringing back the fun, creativity and independence that made the web great.</h1>
<p> <p>
We are tired of living in an online world where people are isolated from each other on boring web sites with generic templates defining what people are We are tired of living in an online world where people are isolated from each other on boring web sites with generic templates defining what people are
@ -43,7 +43,7 @@
<p> <p>
PS: What are you waiting for? <strong><a href="/new">Go make your web site!</a></strong> PS: What are you waiting for? <strong><a href="/new">Go make your web site!</a></strong>
</p> </p>
<h2>Neocities is:</h2> <h1>Neocities is:</h1>
<ul> <ul>
<li><strong>Helping the web.</strong> We are here to empower people to develop independent, creative sites.</li> <li><strong>Helping the web.</strong> We are here to empower people to develop independent, creative sites.</li>
<li><strong>Free.</strong> We will always have a free web site option.</li> <li><strong>Free.</strong> We will always have a free web site option.</li>
@ -59,7 +59,7 @@
</article> </article>
<hr /> <hr />
<section> <section>
<h2 class="beta txt-Center">The Neocities Team</h2> <h1 class="beta txt-Center">The Neocities Team</h1>
<div class="row txt-Center"> <div class="row txt-Center">
<div class="col col-33"> <div class="col col-33">
@ -88,7 +88,7 @@
<hr /> <hr />
<section> <section>
<h3 class="txt-Center"><a href="https://twitter.com/neocitiesweb">Follow us on Twitter</a></h3> <h2 class="txt-Center"><a href="https://twitter.com/neocitiesweb">Follow us on Twitter</a></h2>
</section> </section>
</div> </div>

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="delta">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>

View file

@ -6,7 +6,7 @@
<div class="header-Outro"> <div class="header-Outro">
<div class="row content single-Col"> <div class="row content single-Col">
<div class="col col-50"> <div class="col col-50">
<h2 class="beta">Support Neocities</h2> <h1>Support Neocities</h1>
</div> </div>
<div class="txt-Right"> <div class="txt-Right">
<img src="/assets/img/support-us.png" width="55"> <img src="/assets/img/support-us.png" width="55">
@ -28,7 +28,7 @@
<a href="/plan/manage">Manage plan</a> <a href="/plan/manage">Manage plan</a>
<% else %> <% else %>
<% if current_site %> <% if current_site %>
<p>You currently have the <strong>Free Plan (<%= current_site.maximum_space_in_megabytes %>MB)</strong>. You should upgrade to the <strong>Neocities Supporter Plan!</strong></p> <p>You currently have the <strong>Free Plan (<%= current_site.maximum_space_in_megabytes %>MB)</strong>. Need more space? Become a <strong>Neocities Supporter!</strong></p>
<h3>Why upgrade?</h3> <h3>Why upgrade?</h3>
<% else %> <% else %>

View file

@ -17,8 +17,8 @@
p.tiny You currently have the <strong>Supporter Plan (#{current_site.maximum_space_in_megabytes}MB)</strong>. Thank you! We love you. p.tiny You currently have the <strong>Supporter Plan (#{current_site.maximum_space_in_megabytes}MB)</strong>. Thank you! We love you.
a.btn-Action href="/plan" Manage Plan a.btn-Action href="/plan" Manage Plan
- else - else
p.tiny You currently have the <strong>Free Plan (#{current_site.maximum_space_in_megabytes}MB)</strong>.<br>Need more space, or want to help support Neocities? Upgrade! p.tiny You currently have the <strong>Free Plan (#{current_site.maximum_space_in_megabytes}MB)</strong>.<br>Want to get more space and help Neocities? Become a supporter!
a.btn-Action href="/plan" Upgrade Plan a.btn-Action href="/plan" Supporter Info
.row .row
.col.col-33 .col.col-33