Skip to content

Instantly share code, notes, and snippets.

View nordringrayhide's full-sized avatar

Nodrin Grayhide nordringrayhide

  • home
  • Worldwide
View GitHub Profile
@nordringrayhide
nordringrayhide / deploy.rb
Created July 5, 2012 16:13 — forked from mikhailov/0. nginx_setup.sh
Nginx+Unicorn (production-ready setup)
# Capistrano configuration
#
# require 'new_relic/recipes' - Newrelic notification about deployment
# require 'capistrano/ext/multistage' - We use 2 deployment environment: staging and production.
# set :deploy_via, :remote_cache - fetch only latest changes during deployment
# set :normalize_asset_timestamps - no need to touch (date modification) every assets
# "deploy:web:disable" - traditional maintenance page (during DB migrations deployment)
# task :restart - Unicorn with preload_app should be reloaded by USR2+QUIT signals, not HUP
@nordringrayhide
nordringrayhide / deploy.rb
Created July 5, 2012 16:13 — forked from mikhailov/0. nginx_setup.sh
Nginx+Unicorn (production-ready setup)
# Capistrano configuration
#
# require 'new_relic/recipes' - Newrelic notification about deployment
# require 'capistrano/ext/multistage' - We use 2 deployment environment: staging and production.
# set :deploy_via, :remote_cache - fetch only latest changes during deployment
# set :normalize_asset_timestamps - no need to touch (date modification) every assets
# "deploy:web:disable" - traditional maintenance page (during DB migrations deployment)
# task :restart - Unicorn with preload_app should be reloaded by USR2+QUIT signals, not HUP

Using rails_admin without devise

Having a buckload of code to authorize users on your application is something you may like or not. Speaking for myself I hate it. But I still love rails_admin, here's how you install it without devise. Thanks to phoet for providing the hints in the gist I have forked from.

Add RailsAdmin to your Gemfile

do NOT add devise

gem "rails_admin", :git => "git://github.com/sferik/rails_admin.git"

@nordringrayhide
nordringrayhide / Gemfile
Created May 12, 2012 21:29
Rails foreman gem configs
# Usage: bundle --binstubs && bin/foreman start
gem 'unicorn', '~> 4.3.1'
group :development do
gem 'foreman', '~> 0.46.0'
end
@nordringrayhide
nordringrayhide / rvm-fetch.patch.txt
Created April 9, 2012 09:50
intall RVM 1.10.3, Ruby 1.8.7, 1.9.2, 1.9.3 for working with Pow & curl with SSL support at OSx Lion && XCode 4.3 command tools
#NOTE it should be applied after rvm-install.sh before rvm-post-install.sh running
#http://jfire.io/blog/2012/03/02/xcode-4-dot-3-homebrew-and-ruby/
vi /path/to/rvm/scripts/fetch
# -k key has been added for SSL certificate checking disable
66 fetch_command="curl -k -f -L --create-dirs -C - " # -s for silent
@nordringrayhide
nordringrayhide / vimify.sh
Created March 19, 2012 09:16
My vimrc file
#!/bin/sh
mkdir -p ~/.vim/bundle/vundle
git clone git://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
wget https://raw.github.com/gist/2104598/fb27ed1e0434575ede483df96692d93a626b1116/vimrc-with-vandle-support.vim \
-O ~/.vimrc
vim +BundleInstall +qall
@nordringrayhide
nordringrayhide / gist:2048790
Created March 16, 2012 06:32
super instead alias_method_chain
class A
def foo
puts 'A#foo'
end
end
class B < A
def foo
super
puts 'B#foo'
@nordringrayhide
nordringrayhide / Gemfile
Created February 29, 2012 06:51 — forked from d--j/Gemfile
# include at least one source and the rails gem
source :gemcutter
gem 'rails', '~> 2.3.5', :require => nil
group :development do
# bundler requires these gems in development
gem 'rails-footnotes'
end
group :test do
@nordringrayhide
nordringrayhide / gist:1894453
Created February 23, 2012 19:17
Command line PostgreSQL database dump
# dump database
PGPASSWORD=<password> && export PGPASSWORD && pg_dump -U <username> \
-h <hostname> <database> > dump.sql && unset PGPASSWORD
# import sql file
PGPASSWORD=<password> && export PGPASSWORD && psql -U <username> \
-h <hostname> -d <database> < dump.sql
@nordringrayhide
nordringrayhide / service
Created January 20, 2012 08:25 — forked from brentkirby/service
Unicorn + Runit + RVM
#!/bin/bash -e
#
# Since unicorn creates a new pid on restart/reload, it needs a little extra love to
# manage with runit. Instead of managing unicorn directly, we simply trap signal calls
# to the service and redirect them to unicorn directly.
#
# To make this work properly with RVM, you should create a wrapper for the app's gemset unicorn.
#
function is_unicorn_alive {