-
-
Save wayneeseguin/351888 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Final Countdown | |
# config.middleware.use Roll | |
class Roll | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
request = Rack::Request.new(env) | |
ip = request.ip | |
if roll? | |
return [302, {'Location' => 'http://www.youtube.com/v/tt_ro2aerQg&autoplay=1&iv_load_policy=3&start=12'}, ["Final Countdown!"]] | |
else | |
@app.call(env) | |
end | |
end | |
private | |
def roll? | |
(rand(10) == 4) | |
end | |
end |
Line 9 is to get the request object in order to retrieve the ip on line 10, we were originally doing the rick-roll based on IP.
That's not my point. They're not used in that... Though it's easy to see how they could be.
Yes, it's simply 'artifact' and/or a launching point for others to do some very crafty things :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what is line 9 and 10 for? they don't seem used at all...