Skip to content

Instantly share code, notes, and snippets.

@diogob
diogob / default
Created October 15, 2011 18:53
Nginx sample site config
upstream production {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a
# single worker for timing out).
# for UNIX domain socket setups:
server unix:/home/<app>/sockets/.production.sock fail_timeout=0;
}
server {
listen 80 default;
@diogob
diogob / unicorn_production.rb
Created October 15, 2011 18:52
Unicorn sample config file
worker_processes 4
working_directory "/home/<appname>/<appname>branches/production"
# we use a shorter backlog for quicker failover when busy
listen "/home/<appname>/sockets/.production.sock", :backlog => 64
# feel free to point this anywhere accessible on the filesystem
pid "/home/<appname>/pids/unicorn_production.pid"
@diogob
diogob / hercules.yml
Created October 15, 2011 18:49
Hercules sample config file
---
ploto:
token: <seu-token-aqui>
repository: <git url>
target_directory: <path para deploy>
production:
checkout_on_startup: true
checkouts_to_keep: 3
@diogob
diogob / cast_or_null.sql
Created June 9, 2011 16:52
cast_or_null
CREATE OR REPLACE FUNCTION cast_or_null(src text, INOUT dst anyelement)
LANGUAGE plpgsql AS $$
BEGIN
dst := CAST(src AS anyelement);
EXCEPTION
WHEN others THEN
dst := NULL::anyelement;
END;
$$;
@diogob
diogob / pgsql.vim
Created April 28, 2011 11:52
Vim syntax highlight for PostgreSQL by Devrim GUNDUZ (http://www.gunduz.org/postgresql/pgsql.vim)
" Vim syntax file
" Language: pgsql
" Maintainer: Devrim GUNDUZ <devrim@PostgreSQL.org>
" Last Change: $Date: 2010/03/11 21:43:23 $
" Filenames: *.pgsql *.plpgsql
" URL: http://www.gunduz.org/postgresql/pgsql.vim
" Note: The definitions below are for PostgreSQL 8.4, some versions may differ.
" Changelog: Thanks to Todd A. Cook for the updates
" Changelog: Thanks a lot to David Fetter for the big update set, that came as of Mar 11, 2010.
snippet it
it("should ${1:do...}", function(){
});
snippet before
beforeEach(function(){
});
snippet describe
describe("${1:test subject}", function(){
@diogob
diogob / .vimrc
Last active March 24, 2024 01:03
My vimrc
set nocompatible " be iMproved
filetype off " required!
call plug#begin('~/.vim/plugged')
" Plugs:
" Utilities
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
π foo bar (baz ⋈ qux)
π foo bar σ corge = grault (baz ⋈ qux)
π foo bar σ corge = grault AND garply = waldo (baz ⋈ qux)
@diogob
diogob / rails_template.rb
Created January 20, 2011 20:09
My neat rails template created by RailsWizard
# >---------------------------[ Install Command ]-----------------------------<
# rails new APP_NAME -m http://railswizard.org/168b0f6c5ccb55ec3117.rb -T -J
# >---------------------------------------------------------------------------<
#
# _____ _ _ __ ___ _
# | __ \ (_) | \ \ / (_) | |
# | |__) |__ _ _| |___\ \ /\ / / _ ______ _ _ __ __| |
# | _ // _` | | / __|\ \/ \/ / | |_ / _` | '__/ _` |
# | | \ \ (_| | | \__ \ \ /\ / | |/ / (_| | | | (_| |
@diogob
diogob / ubuntu-setup.sh
Created January 12, 2011 19:49
Setup a minimal Ruby+PostgreSQL environment in Ubuntu 11.04 (should be called as root)
apt-get update
apt-get install aptitude
aptitude install python-software-properties
apt-add-repository ppa:pitti/postgresql
add-apt-repository ppa:nginx/stable
aptitude update
aptitude install ruby1.9.1-full build-essential postgresql-server-dev-9.1 postgresql-contrib-9.1 nginx vim-nox git-core htop atop most
pg_dropcluster 9.1 main --stop
echo "pt_BR.UTF-8 UTF-8" > /var/lib/locales/supported.d/pt_BR
locale-gen