Skip to content

Instantly share code, notes, and snippets.

# This will ride alongside god and kill any rogue memory-greedy
# processes. Their sacrifice is for the greater good.
unicorn_worker_memory_limit = 300_000
Thread.new do
loop do
begin
# unicorn workers
#
@IPrism
IPrism / album_spec.rb
Created July 12, 2011 15:59 — forked from TomK32/album_spec.rb
Example for testing mongoid assocications with Rspec
require 'spec_helper'
describe Album do
before(:all) do
@album = Factory.build(:album)
@website = @album.website
end
it "should be valid" do
@album.should be_valid
end
@IPrism
IPrism / gist:1069516
Created July 7, 2011 13:34 — forked from cwsaylor/gist:17522
God init script
#!/bin/bash
### BEGIN INIT INFO
# Provides: god
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the god monitoring processes
# Description: Enable god at boot time.
### END INIT INFO
@IPrism
IPrism / gist:1067612
Created July 6, 2011 16:03 — forked from defunkt/gist:208581
god script for unicorn + rvm
# http://unicorn.bogomips.org/SIGNALS.html
# change these to match your app
app_name = "APP_NAME"
rvm_string = "RVM_STRING"
user = "USER"
pid_file = "/srv/webapps/#{app_name}/shared/pids/#{app_name}.pid"
gem_home = "/usr/local/rvm/gems/#{rvm_string}"
app_root = "/srv/webapps/#{app_name}/current"
@IPrism
IPrism / gist:1010289
Created June 6, 2011 13:46 — forked from matiaskorhonen/gist:420880
startup script for unicorn with rvm global installation
#!/bin/bash
### BEGIN INIT INFO
# Provides: APPLICATION
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the APPLICATION unicorns at boot
# Description: Enable APPLICATION at boot time.
### END INIT INFO
/*
Jquery and Rails powered default application.js
Easy Ajax replacement for remote_functions and ajax_form based on class name
All actions will reply to the .js format
Unostrusive, will only works if Javascript enabled, if not, respond to an HTML as a normal link
respond_to do |format|
format.html
format.js {render :layout => false}
end
*/