Skip to content

Instantly share code, notes, and snippets.

View micahwedemeyer's full-sized avatar

Micah Wedemeyer micahwedemeyer

View GitHub Profile
require 'rack/utils'
class FlashSessionCookieMiddleware
def initialize(app, session_key = 'my_session_key')
@app = app
@session_key = (session_key || 'my_session_key')
end
def call(env)
if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/
createInsult = (cb, res) ->
redis = require('redis')
redisUrl = process.env.REDISTOGO_URL || "redis://127.0.0.1:6379/"
redisClient = require('redis-url').connect(redisUrl)
redisClient.srandmember "adjectives", (err, adj) ->
redisClient.srandmember "nouns", (err, noun) ->
redisClient.srandmember "verbs", (err, verb) ->
insult = "is a " + adj + " " + noun + " " verb
cb(insult, res)
@micahwedemeyer
micahwedemeyer / cookie_decoder.js
Last active June 25, 2016 04:55
Verify and decrypt cookies in Node.js generated by the gorilla toolkit securecookie library