Skip to content

Instantly share code, notes, and snippets.

#Based off camwest's gist at https://gist.github.com/363958
#Using to_s instead of extending String
require 'openssl'
require 'cgi'
class S3QueryURL
def initialize(bucket, path, options = {})
@access_key_id = options[:access_key_id]
class ApplicationController < ActionController::Base
# Creates an accessor which is exposed to the view
def self.view_accessor(*names)
attr_accessor *names
helper_method *names
end
end
# Usage: redis-cli publish message.achannel hello
require 'sinatra'
require 'redis'
conns = Hash.new {|h, k| h[k] = [] }
Thread.abort_on_exception = true
get '/' do
# MongoMapper "embedded document delete" plugin
# By Peter Cooper
#
# Got embedded documents you want to delete? You can delete them as if the
# embedded document collection were an array, but then there's no way to get
# a callback (as far as I could tell). This plugin gives you a call back
# (if you want it) and gives a nicer syntax to deleting embedded docs.
#
# Example:
#