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
#!/bin/bash | |
# Install RVM | |
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) | |
# Modify ~/.bash_profile as necessary and source it to bring in changes | |
echo "[[ -s \"\$HOME/.rvm/scripts/rvm\" ]] && source \"\$HOME/.rvm/scripts/rvm\"" >> ~/.bash_profile | |
source ~/.bash_profile | |
# Install and use Ruby 1.9.2 | |
rvm install ruby-1.9.2-p0 && rvm use 1.9.2 | |
# Create a gemset for and install Rails 3 RC | |
rvm gemset create tu3 && rvm use 1.9.2@tu3 |
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
@paperclip_defaults = { | |
:styles => { | |
:large=>{ | |
:convert_options=>"-auto-orient -strip", | |
:whiny=>true, | |
:geometry=>"400x300^" | |
}, | |
:thumb=>{ | |
:convert_options=>"-auto-orient -strip", | |
:whiny=>true, |
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
function resetData { | |
mysql -u root --execute="DROP DATABASE ${1:-thredup3_development};" | |
mysql -u root --execute="CREATE DATABASE ${1:-thredup3_development};" | |
gzip -d ./tmp/thredup.sql.gz | |
mysql -u root ${1:-thredup3_development} < ./tmp/thredup.sql | |
mysql -u root ${1:-thredup3_development} < ./db/clean_test_data.sql | |
} |
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 ListingWindow | |
SKIP_N_PERIODS = { | |
"exclusive" => 1, | |
"pickable" => 2 | |
} | |
WINDOW_TIMES = [9,18] | |
LISTING_TIME_ZONE = "Pacific Time (US & Canada)" | |
#LISTING_TIME_ZONE = "UTC" |
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 self.schedule_announcement(email_name,users = nil,time_to_run = nil) | |
lim = Rails.env == "production" ? nil : 175 | |
users ||= self.address_completed.select("users.id").limit(lim).all | |
time_to_run ||= Time.now | |
group_size = 50 | |
groups = users.count / group_size | |
(groups + 1).times do |i| | |
group_start = i * group_size |
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
Spork.prefork do | |
require "thinking_sphinx" | |
Spork.trap_method(ThinkingSphinx::Context, :load_models) | |
... | |
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
Spork.prefork do | |
if Spork.using_spork? | |
require "thinking_sphinx" | |
Spork.trap_method(ThinkingSphinx::Context, :load_models) | |
end | |
... | |
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 Delayed::Worker | |
alias_method :original_handle_failed_job, :handle_failed_job | |
def handle_failed_job(job, error) | |
HoptoadNotifier.notify(error) | |
original_handle_failed_job(job, error) | |
end | |
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 Delayed::Worker | |
alias_method :original_handle_failed_job, :handle_failed_job | |
def handle_failed_job(job, error) | |
HoptoadNotifier.notify(error,{:parameters => {:job => job.attributes}}) | |
if Rails.env.test? | |
ap "FAILED DELAYED JOB" | |
ap job | |
ap error | |
ap error.backtrace |
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
# IMPORTANT: On your machine, with the ec2 instance running | |
# Basic Config variables | |
instanceid=<instance-id> | |
size=50 | |
#Get the root EBS volume id and availability zone for this instance: | |
oldvolumeid=$(ec2-describe-instances $instanceid | | |
egrep "^BLOCKDEVICE./dev/sda1" | cut -f3) | |
zone=$(ec2-describe-instances $instanceid | egrep ^INSTANCE | cut -f12) | |
echo "instance $instanceid in $zone with original volume $oldvolumeid" |
OlderNewer