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 FriendsController | |
def index | |
@friends = @user.friends | |
@friends_of_friends = slow { @user.friends_of_friends } | |
end | |
def import | |
@result = slow { @user.friends.import(params[:big_csv]) } | |
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 Gem::Dependency | |
def to_bundler | |
args = [] | |
args << name | |
args << specification.version.to_s if specification.version.to_s.present? | |
options = {} | |
options[:require_as] = lib if lib.present? | |
str = "gem '#{args.join "', '"}'" | |
str << ", #{options.inspect.gsub(/[\{\}]/, '')}" if options.present? | |
str |
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 'activesupport' | |
class StringReplacer | |
NEWLINE = "AijQA6tD1wkWqgvLzXD" | |
START_MARKER = '# START StringReplacer %s -- DO NOT MODIFY' | |
END_MARKER = "# END StringReplacer %s -- DO NOT MODIFY#{NEWLINE}" | |
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
# (1) clone app_production to app_staging | |
# (2) hit it a couple times so it can cache any s3/etc. data it needs to start up (once you change the data, s3/etc. won't work) | |
# (3) cap y2k:set DATE="2010-01-01" | |
# (4) ...test the site... | |
# (5) cap y2k:unset | |
task :app_staging do | |
set :rails_env, 'production' | |
set :deploy_to, '/data/app' | |
role :app, "ec2-X-X-X-X.compute-1.amazonaws.com" | |
role :app, "ec2-Y-Y-Y-Y.compute-1.amazonaws.com" |
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
my-macbook:~/app $ cap y2k:set DATE="2009-12-31 20:59:40" | |
* executing `y2k:set' | |
* executing `app_staging' | |
* executing "sudo -p 'sudo password: ' sh -c \"echo 1 > /proc/sys/xen/independent_wallclock\"" | |
servers: ["ec2-X-X-X-X.compute-1.amazonaws.com", "ec2-X-X-X-X.compute-1.amazonaws.com", "ec2-X-X-X-X.compute-1.amazonaws.com"] | |
[ec2-X-X-X-X.compute-1.amazonaws.com] executing command | |
[ec2-X-X-X-X.compute-1.amazonaws.com] executing command | |
[ec2-X-X-X-X.compute-1.amazonaws.com] executing command | |
command finished | |
* executing "sudo -p 'sudo password: ' date --set=\"2009-12-31 20:59:40\"" |
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
if File.exists?(File.join(RAILS_ROOT,'tmp', 'passenger_debug.txt')) | |
require 'ruby-debug' | |
Debugger.wait_connection = true | |
Debugger.start_remote | |
File.delete(File.join(RAILS_ROOT,'tmp', 'passenger_debug.txt')) | |
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
(in our app) | |
class Automobile < ActiveRecord::Base | |
[...] | |
include BrighterPlanet::Automobile | |
end | |
(in an open source repo/gem) | |
module BrighterPlanet |
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 'net/imap' | |
require 'tmail' | |
class ImapChecker | |
include Singleton | |
SERVER = 'secure.emailsrvr.com' | |
USERNAME = 'A' | |
PASSWORD = 'A' | |
SEARCH_CRITERIA = %w{ TO offset } |
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 'daemon_spawn' # currently seamusabshere-daemon-spawn | |
# BASEDIR = '/var/www/html/offset1' | |
BASEDIR = '/home/vagrant/offset1' | |
PID_PATH = "#{BASEDIR}/daemons/offset1_imap_checker.pid" | |
LOG_PATH = "#{BASEDIR}/log/offset1_imap_checker.log" | |
TIMEOUT = 60 | |
# SIGNAL = 'INT' |
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
diff --git a/VERSION b/VERSION | |
index 0c62199..53a75d6 100644 | |
--- a/VERSION | |
+++ b/VERSION | |
@@ -1 +1 @@ | |
-0.2.1 | |
+0.2.6 | |
diff --git a/lib/daemon_spawn.rb b/lib/daemon_spawn.rb | |
index 2e3d628..f032d55 100644 | |
--- a/lib/daemon_spawn.rb |
OlderNewer