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
def valid_request? | |
query = params.except('action', 'controller') | |
supplied_signature = query.delete('signature') | |
return false unless supplied_signature | |
query = query.sort_by { |k,v| k.downcase } | |
digest = OpenSSL::Digest::Digest.new('sha1') | |
hmac = OpenSSL::HMAC.digest(digest, AMAZON_SECRET_KEY, query.to_s) |
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
## | |
# This would be visited by the person ultimately paying for the service or | |
# product, sometimes referred to as your "end customer". | |
# | |
class ClientController < ApplicationController | |
## | |
# Generate and redirect the client to the single use payment pipeline, using | |
# the recipient token collected earlier. | |
# |
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 Test::Unit::TestCase | |
def assert_did_not_send_email | |
if block_given? | |
msg = "One or more sent emails matched your criteria.\n" | |
emails = ::ActionMailer::Base.deliveries | |
matching_emails = emails.select {|email| yield email } | |
assert matching_emails.empty?, msg | |
else | |
msg = "Sent #{::ActionMailer::Base.deliveries.size} emails.\n" |
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
// Be sure to first include the Google AJAX libraries script in your HTML. | |
// <script src="http://www.google.com/jsapi" type="text/javascript"></script> | |
// Wrap your plugin in a function to execute after jQuery has downloaded and | |
// loaded to your client. | |
function load_jquery_form_plugin() { | |
/* | |
* jQuery Form Plugin | |
* version: 2.24 (10-MAR-2009) | |
* @requires jQuery v1.2.2 or later |
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 | |
alias_method_chain :cache_page, :subdomain | |
private | |
## | |
# Inserts the currently requested subdomain as a directory in front of the | |
# cached file location. Assuming you've moved the default page cache | |
# storage location to /public/cache, a request to app1.example.com would be |
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
<% | |
git_branches = `cd "#{RAILS_ROOT}"; /opt/local/bin/git branch --no-color` | |
git_branch = git_branches.split("\n").detect { |b| b =~ /\A\*/ }.gsub(/\A\* /, '') | |
%> | |
common: &common | |
adapter: sqlite3 | |
timeout: 5000 | |
development: |
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
From 33be3517c2f8c0ec2c1d519ea40acb1e704c485a Mon Sep 17 00:00:00 2001 | |
From: Nathaniel Bibler <git@nathanielbibler.com> | |
Date: Fri, 9 Oct 2009 14:22:28 -0400 | |
Subject: [PATCH] Patch for httpclient with soap4r support | |
--- | |
lib/fake_web.rb | 1 + | |
lib/fake_web/ext/httpclient.rb | 58 ++++++++++++++++++++++++++++++++++++++++ | |
2 files changed, 59 insertions(+), 0 deletions(-) | |
create mode 100644 lib/fake_web/ext/httpclient.rb |
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
module Rack | |
class PrefetchKiller | |
def initialize(app, options = {}) | |
@app = app | |
end | |
def call(env) | |
google_prefetch?(env) ? head_forbidden : @app.call(env) | |
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
Warden::Strategies.add(:site_basic) do | |
def valid? | |
authorization.present? | |
end | |
def authenticate! | |
if authorization.present? | |
site = Site.find_by_identifier_and_token(*user_name_and_password) | |
site ? success!(site) : fail!("Unauthorized") |
OlderNewer