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
#!/bin/bash | |
## | |
# Move into the ROOT of the application | |
cd .. | |
## | |
# Copy database.example.yml to database.yml | |
cp config/database.example.yml config/database.yml |
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 'time' | |
require 'date' | |
Time.now.rfc2822 |
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 'rails/all' | |
require "action_controller/railtie" | |
require "action_mailer/railtie" | |
require "active_resource/railtie" | |
require "rails/test_unit/railtie" |
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
MongoHQ database URI example: | |
mongo://username:password@flame.mongohq.com:27065/database-name |
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
## | |
# With regular RSpec stubbing | |
it 'should allow JPG images' do | |
photo = Photo.new :photo => fixture_file_upload('photos/chameleon.jpg', 'image/jpeg') | |
photo.stub!(:save_attached_files).and_return true | |
photo.save.should be_true | |
end | |
## | |
# With Mocha on "any" instance of a Class |
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
## | |
# Install the Readline package before installing ruby versions | |
rvm package install readline | |
## | |
# Then install a Ruby version with the readline path specified | |
rvm install ree -C --with-readline-dir=$HOME/.rvm/usr |
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 Dragonfly | |
module Endpoint | |
def success_headers(job) | |
{ | |
"Content-Type" => job.app.resolve_mime_type(job.result), | |
"Content-Length" => job.size.to_s, | |
"Content-Disposition" => "filename=#{job.name}" | |
}.merge(cache_headers(job)) | |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'daemons' | |
RAILS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) | |
PID_DIR = File.join(RAILS_ROOT, 'tmp', 'pids') | |
Daemons.run_proc('delayed_job', { :dir => PID_DIR, :dir_mode => :normal }) do | |
ENV['RAILS_ENV'] ||= 'development' | |
Dir.chdir RAILS_ROOT |
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
RAILS_ROOT = File.dirname(File.dirname(__FILE__)) | |
God.watch do |w| | |
w.name = 'dj-worker' | |
w.group = 'dj' | |
w.interval = 30.seconds | |
w.start = "rake -f #{RAILS_ROOT}/Rakefile -I #{RAILS_ROOT} RAILS_ENV=production jobs:work" | |
# retart if memory gets too high | |
w.transition(:up, :restart) do |on| |