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
tmp | |
log | |
doc | |
daemon | |
*.swp |
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 VerboseJob | |
module ClassMethods | |
def wrap_perform! | |
class << self | |
def perform_with_verbose(*args) | |
JobLogger.verbose { perform_without_verbose(*args) } | |
end | |
alias_method_chain :perform, :verbose \ | |
unless instance_method(:perform) == instance_method(:perform_with_verbose) |
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 respond_with(*resources, &block) | |
raise "In order to use respond_with, first you need to declare the formats your " << | |
"controller responds to in the class level" if self.class.mimes_for_respond_to.empty? | |
if collector = retrieve_collector_from_mimes(&block) | |
options = resources.size == 1 ? {} : resources.extract_options! | |
options[:default_response] = collector.response | |
(options.delete(:responder) || self.class.responder).call(self, resources, options) | |
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
class SpecialResponderController < ActionController::Base | |
protected | |
def self.responder | |
lambda do |controller, resources, options| | |
if controller.is_special? | |
SpecialResponder.call(controller, resources, options) | |
else | |
super.call(controller, resources, options) | |
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
require 'nokogiri' | |
require 'css_parser' | |
module InlineCSSHelper | |
include CssParser | |
# Takes a string of HTML and inlines any css blocks in it. | |
def inline_css(message) | |
css_parser = CssParser::Parser.new | |
doc = Nokogiri::HTML(message) |
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
require 'yaml' | |
YAML::ENGINE.yamler= 'syck' |
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 FacebookSession | |
def parse_signed_request(secret_id,request) | |
encoded_sig, payload = request.split('.', 2) | |
sig = "" | |
urldecode64(encoded_sig).each_byte { |b| | |
sig << "%02x" % b | |
} | |
data = JSON.parse(urldecode64(payload)) | |
if data['algorithm'].to_s.upcase != 'HMAC-SHA256' | |
raise "Bad signature algorithm: %s" % data['algorithm'] |
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 do_fbjs_create | |
post :create, :contact => @fb_contact, :fb_sig_is_ajax => 1, :page_slug => @landing_page.slug | |
end | |
def do_fbml_create | |
post :create, :contact => @fb_contact, :fb_sig => 43243243214321, :page_slug => @landing_page.slug | |
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
user _www; | |
worker_processes 1; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; | |
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
<div id="fb-root"> | |
<div style="background-color:#FFFFFF; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;min-height:750px;"> | |
<link rel="stylesheet" type="text/css" href="{{page.host_path}}/screen.css" /> | |
<div id="cny-home-expo-01"> | |
<img src="{{page.host_path}}/cny-home-expo_01.gif" width="520" height="109" alt=""> | |
</div> | |
<div id="cny-home-expo-02"> | |
<img src="{{page.host_path}}/cny-home-expo_02.gif" width="253" height="362" alt=""> | |
</div> | |
<div id="cny-home-expo-03"> |