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 ENV['RAILS_ENV'] && !Object.const_defined?('RAILS_DEFAULT_LOGGER') | |
require 'logger' | |
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT) | |
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
Bluepill.application("app_name") do |app| | |
app.process("app_name") do |process| | |
process.start_command = "cd /u/apps/app_name/current && /usr/local/bin/unicorn_rails -c /u/apps/app_name/current/config/unicorn.conf.rb -E production -D" | |
process.stop_command = "kill -QUIT `cat /u/apps/app_name/current/tmp/pids/unicorn.pid`" | |
process.restart = "kill -USR2 `cat /u/apps/app_name/current/tmp/pids/unicorn.pid`" | |
process.stdout = process.stderr = "/u/apps/app_name/current/log/unicorn.log" | |
process.pid_file = "/u/apps/app_name/current/tmp/pids/unicorn.pid" | |
process.checks :mem_usage, :every => 10.seconds, :below => 250.megabytes, :times => [3, 5] | |
process.uid = "app" | |
process.gid = "app" |
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 Project < ActiveRecord::Base | |
alias :old_read_attribute :read_attribute | |
def read_attribute(attr) | |
old_read_attribute(attr) or 'none' | |
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 Project < ActiveRecord::Base | |
def name | |
read_attribute(:name) or 'none' | |
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
development: | |
adapter: sqlite3 | |
database: db/development.sqlite3 | |
timeout: 5000 | |
test: | |
adapter: sqlite3 | |
database: db/test.sqlite3 | |
timeout: 5000 |
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 Rack | |
class Clicky | |
TRACKING_CODE = <<-EOTC | |
<script src="http://static.getclicky.com/js" type="text/javascript"></script> | |
<script type="text/javascript">clicky.init({{CODE}});</script> | |
<noscript><p><img alt="Clicky" width="1" height="1" src="http://in.getclicky.com/{{CODE}}ns.gif" /></p></noscript> | |
EOTC | |
def initialize(app, site_id, options = {}) |
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 signup | |
user = User.new(blah blah blah) | |
begin | |
UserMailer.email_confirmation(user).deliver | |
rescue Exception => e | |
handle error | |
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
User.all(:conditions => { :birthday => (Time.now.midnight - 1.day)..(Time.now.midnight + 1.month}, :active => true) |
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 Rack | |
class Konami | |
KONAMI_CODE = <<-EOTC | |
<div id="rack_konami" style="display:none;position:fixed;top:20%;right:50%;"> | |
{{HTML}} | |
</div> | |
<script type="text/javascript"> | |
var Konami=function(){var a={addEvent:function(b,c,d,e){if(b.addEventListener)b.addEventListener(c,d,false);else if(b.attachEvent){b["e"+c+d]=d;b[c+d]=function(){b["e"+c+d](window.event,e)};b.attachEvent("on"+c,b[c+d])}},input:"",pattern:"3838404037393739666513",load:function(b){this.addEvent(document,"keydown",function(c,d){if(d)a=d;a.input+=c?c.keyCode:event.keyCode;if(a.input.length>a.pattern.length)a.input=a.input.substr(a.input.length-a.pattern.length);if(a.input==a.pattern){a.code(b);a.input= | |
""}},this);this.iphone.load(b)},code:function(b){window.location=b},iphone:{start_x:0,start_y:0,stop_x:0,stop_y:0,tap:false,capture:false,orig_keys:"",keys:["UP","UP","DOWN","DOWN","LEFT","RIGHT","LEFT","RIGHT","TAP","TAP","TAP"],code:function(b){a.code(b)},load:function(b){orig_keys=this.keys;a.addEvent(do |
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 'rubygems' | |
require 'bacon' | |
describe 'A new array' do | |
before do | |
@ary = (1..10).to_a | |
end | |
it 'should not be empty' do | |
@ary.length.should.be > 1 |