Skip to content

Instantly share code, notes, and snippets.

View sigerello's full-sized avatar

Oleksandr Serhiienko sigerello

View GitHub Profile
module ApplicationHelper
# Access Levels
ACCESS_LEVELS = { :private => 0, :friends => 1, :public => 2 }
# Access levels i18n translation
def access_levels
ACCESS_LEVELS.collect{|k,v| [I18n.t("access." + k.to_s), v]}
end
end
# Customizing your Responder to always redirect to the collection path (index action).
class AppResponder < ActionController::Responder
protected
# Overwrite navigation_behavior to redirect to the collection_location.
def navigation_behavior(error)
if get?
raise error
elsif has_errors? && default_action
render :action => default_action
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by jay@gooby.org http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by jay@gooby.org http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##
@sigerello
sigerello / unicorn
Created August 31, 2010 17:14
/etc/init.d script for unicorn
#!/bin/sh
# chkconfig: 2345 85 15
# description: init.d script for single or multiple unicorn installations. Expects at least one .conf file in /etc/unicorn
# processname: unicorn
#
## A sample /etc/unicorn/my_app.conf
##
## RAILS_ENV=production
## RAILS_ROOT=/var/apps/www/my_app/current
#
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by jay@gooby.org http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by jay@gooby.org http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##
#!/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