This file contains 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
#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] |
This file contains 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
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 |
This file contains 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
# 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 |
This file contains 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
# 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: | |
# |