Skip to content

Instantly share code, notes, and snippets.

@everaldo
everaldo / localized_date.rb
Created October 27, 2011 22:11
LiquidFilter para converter uma data para dia mês ano com o nome do mês em Português
#encoding: utf-8
module LocalizedDateLiquidFilter
MESES = [nil] + %w(Janeiro Fevereiro Março Abril Maio Junho Julho Agosto Setembro Outubro Novembro Dezembro)
def localized_date(date)
if date.class == String
date = Time.parse(date)
end
@everaldo
everaldo / create_repository.sh
Created March 15, 2012 20:35
Criando um repositorio Git
$sudo git init --bare my_project.git
Initialized empty Git repository in /opt/git/my_project.git/
$sudo chown -R git:git my_project.git/
git clone user@git.example.com:/opt/git/my_project.git
@everaldo
everaldo / heroku.md
Created May 28, 2012 02:24 — forked from jaymcgavren/heroku.md
A Code TV screencast on getting started with Heroku

Description

Heroku is a simple way to publish your Rails app, and a powerful platform that will allow it to scale. In this episode, Jay McGavren gets you started with your first Heroku app.

Set up your Rails app

Isolate your gem environment

  • You WANT Rails to fail locally if a gem isn't in your Gemfile
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
@everaldo
everaldo / .irbrc
Last active December 11, 2015 02:59
Instalação do Rbenv
require 'irb/ext/save-history'
#History configuration
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
@everaldo
everaldo / .vimrc
Last active December 12, 2015 03:08
execute pathogen#infect()
syntax on
filetype plugin indent on
set expandtab
set tabstop=2 shiftwidth=2 softtabstop=2
set autoindent
@everaldo
everaldo / install_mongodb.sh
Last active December 13, 2015 20:18
Instalação do MongoDB
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
sudo touch /etc/apt/sources.list.d/10gen.list
sudo echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" >> /etc/apt/sources.list.d/10gen.list
sudo apt-get update
sudo apt-get install mongodb-10gen
@everaldo
everaldo / nginx_ppa
Last active December 13, 2015 22:09
Nginx PPA / Nginx + Passenger PPA (Brightbox)
### Esse gist ainda não está 100%
aparentemente tem que fazer um gem install passenger **também**
sudo apt-get install python-software-properties ### PARA INSTALAR add-apt-repository, se não tiver no sistema
sudo apt-get install software-properties-common ### NO UBUNTU 13.04
sudo add-apt-repository ppa:nginx/stable ### PARA INSTALAR SOMENTE NGINX, SEM PASSENGER - USE SOMENTE COM PHP
sudo add-apt-repository --remove ppa:nginx/stable ### PARA REMOVER NGINX, SEM PASSANGER - USE SOMENTE SE TIVER INSTALADO
sudo add-apt-repository ppa:brightbox/passenger-nginx ### PARA INSTALAR VERSAO RECENTE DO NGINX COM PASSENGER
@everaldo
everaldo / install.sh
Last active December 14, 2015 03:19
Configuração de uma VagrantBox: ruby + git + nginx + passenger + mongodb
##Configura repositório apt-do MongoDB
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
sudo touch /etc/apt/sources.list.d/10gen.list
# Esse comando com echo e sudo tee funciona
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/10gen.list
## Esse comando cat com sudo não funciona. Precisa editar manualmente
sudo cat <<EOF > /etc/apt/sources.list.d/10gen.list
#!/bin/bash
set -e # exit on error
### README
# * built for Ubuntu (Lucid Lynx)
# * uses GIT via SSH because of !@#$% proxy at work
# * installs your desired ruby version (1.9.2-p290 per default) using rbenv
# ** including openssl (needed by bundler)
# ** including sqlite (probably needed for rails apps)
#
# Before you start: