Skip to content

Instantly share code, notes, and snippets.

View rodrigodealer's full-sized avatar

Rodrigo Oliveira rodrigodealer

View GitHub Profile
#Color table from: http://www.understudy.net/custom.html
fg_black=$'\e[0;30m'
fg_red=$'\e[0;31m'
fg_green=$'\e[0;32m'
fg_brown=$'\e[0;33m'
fg_blue=$'\e[0;34m'
fg_purple=$'\e[0;35m'
fg_cyan=$'\e[0;36m'
fg_lgray=$'\e[0;37m'
fg_dgray=$'\e[1;30m'
def localiza
page = params[:page]? params[:page].to_i : 1
per_page = params[:per_page]? params[:per_page].to_i : 10
fields = [:pergunta, :resposta, :sistema_nome]
if params[:questao].present?
sistema = params[:questao][:sistema_id]
nome_sistema = params[:questao][:sistema_nome]
query = params[:questao][:keywords]
@rodrigodealer
rodrigodealer / gist:632078
Created October 18, 2010 11:43
nginx file
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
@rodrigodealer
rodrigodealer / gist:648903
Created October 27, 2010 12:02
Version setup
#!/bin/bash
sed "s/\(.*\)version=\(.*\)/\version=$1/g" build.properties > build.properties.new
mv build.properties.new build.properties
git commit -a -m "Version tag: $1"
git tag "$1"
git push --tags
@rodrigodealer
rodrigodealer / gist:648912
Created October 27, 2010 12:11
Deploy via ant
Jars no classpath:
ant-contrib.jar
ant-jsch.jar
-- build.properties --
# Project information
version=1.0
release=1.0.0
@rodrigodealer
rodrigodealer / gist:661027
Created November 3, 2010 12:29
Script commit que nao gera merge commit
#!/bin/sh -x
CURRENT=`git branch | grep "*" | awk '{print $2}'`
if [ CURRENT = "master"]; then
git commit -a -m "[#${CURRENT}] $1"
else
git stash
sink
git stash apply
git commit -a -m "[#${CURRENT}] $1"
git stash clear
@rodrigodealer
rodrigodealer / ruby-debug1.9 no rvm
Created January 12, 2011 13:49
Comando para instalar o ruby-debug para Ruby 1.9 em ambiente RVM
gem install ruby-debug19 -- --with-ruby-include= /Users/rodrigo/.rvm/src/ruby-1.9.2-p136
@rodrigodealer
rodrigodealer / gist:791270
Created January 22, 2011 17:21
Adicionar no env.rb
Before do
require 'factory_girl'
Dir.glob(File.join(File.dirname(__FILE__), '../../spec/factories/*.rb')).each {|f| require f }
Factory.factories.keys.each {|factory| Factory(factory) }
end
# carrega no env.rb
seed_file = File.join(Rails.root, "db", "seeds.rb")
load(seed_file)
# no final, limpa a base de teste
at_exit do
require 'database_cleaner'
@rodrigodealer
rodrigodealer / nginx.conf
Created March 19, 2011 13:56
nginx.conf tunning setup
user nobody;
worker_processes 4;
error_log /var/log/nginx/error.log debug;
worker_rlimit_nofile 32768;
events {
worker_connections 8192; # increase for busier servers
use epoll; # you should use epoll here for Linux kernels 2.6.x
multi_accept on;
}
http {