Skip to content

Instantly share code, notes, and snippets.

@jwo
Created January 18, 2012 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwo/1633140 to your computer and use it in GitHub Desktop.
Save jwo/1633140 to your computer and use it in GitHub Desktop.
Protests on RAILS
class Api::BaseController < ApplicationController
respond_to :json
skip_before_filter :protest_sopa
protected
def unauthorized!
render :text=>"Unauthorized Action", :status=>:unauthorized
end
end
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :protest_sopa
protected
def protest_sopa
return if Time.now > "2012-01-19 06:00:00".to_time
render :file => "public/sopa.html", :status=>503, layout: false
end
end
<html>
<head>
<style type="text/css">
body{
background:#000000;
color:#999;
font-family:Helvetica;
font-size:16px;
margin:20% auto;
max-width:600px;
line-height:1.3em;
}
a{
color:#fff;
}
a:hover{
color:#a00;
}
</style>
</head>
<body>
<h2>503: Service Unavailable</h2>
<p>We Eatt is offline today, because the US Senate is considering legislation that would certainly kill us forever. The legislation is called the PROTECT IP Act (PIPA) and like SOPA, is the worst.thing.ever. Well, the worst legislation concering the internet ever, for sure.</p>
<p>Basically, it would shut this site down -- we would be legally responsible for policing the content that users upload. For We Eatt, that means <i>SOMEHOW</i> guaranteeing that the recipes users upload do not infringe anyone else's recipes anywhere in the world. We Eatt would shut down.</p>
<p>We don't want that. If you don't want it either, visit <a href="http://americancensorship.org">AmericanCensorship.org</a> for instructions on contacting your Senator. The <a href="http://blacklists.eff.org">Electronic Frontier Foundation</a> has more information on this and other issues central to your freedom online.</p>
<p>Thanks,
<br/>Jesse @ We Eatt
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment