Skip to content

Instantly share code, notes, and snippets.

View dimoreira's full-sized avatar
🏠
Working from home

Diego Moreira dimoreira

🏠
Working from home
View GitHub Profile
##
# Fazendo deploy com o capistrano de uma aplicação Rails
# usando servidores da Amazon ec2 e unicorn como servidor
# o versionamento do ruby no ambiente de produção foi feito
# com o rbenv ( https://github.com/sstephenson/rbenv ), o SO
# esta com o Centos 5.3 x64
#
# Primeiramente é necessario instalar a gem com o comando:
# gem install capistrano
# ou adicione a linha: gem "capistrano", :group => :development
@dimoreira
dimoreira / install.sh
Last active December 18, 2015 17:28 — forked from everaldo/install.sh
Configuração versão recente NGINX + Passenger
sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev git-core sqlite3 libsqlite3-dev libssl-dev libreadline-dev
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
echo 'eval "$(rbenv init -)"' >> ~/.profile
source .profile
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install --list #lista versões disponíveis do ruby
rbenv install 1.9.3-p374 # instala a última versão estável
rbenv rehash # sempre que instalar algum binário do ruby (gem ou versão) tem que rodar o rehash

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
@dimoreira
dimoreira / example.html
Created June 21, 2013 15:01 — forked from kylebarrow/example.html
iOS Web App Links prevent open Safari
<!DOCTYPE html>
<head>
<title>Stay Standalone</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script src="stay_standalone.js" type="text/javascript"></script>
</head>
<body>
<ul>
<li><a href="http://google.com/">Remote Link (Google)</a></li>
@dimoreira
dimoreira / setup.md
Last active December 18, 2015 23:49
Production setup with RVM + Nginx + Unicorn in Ubuntu

Setup the RVM + Nginx + Unicorn in Ubuntu


Init by installing necessary linux headers

$ sudo apt-get update
$ sudo apt-get install build-essential vim git-core curl
$ sudo apt-get install libcurl4-openssl-dev libx11-dev libffi-dev tcl-dev tk-dev
@dimoreira
dimoreira / MyVimRC
Created June 26, 2013 03:57
My .vimrc file for configuration
set encoding=utf-8
set number
syntax enable
set smartindent
set autoindent
set tabstop=4
set shiftwidth=4
set background=dark
colorscheme desert
@dimoreira
dimoreira / configuracao.md
Last active December 20, 2015 04:39
Configuração de Produção com RVM + Nginx + Unicorn no Ubuntu

Configuração de Produção com RVM + Nginx + Unicorn no Ubuntu


Comece instalando os linux headers necessários

$ sudo apt-get update
$ sudo apt-get install build-essential vim git-core curl
$ sudo apt-get install libcurl4-openssl-dev libx11-dev libffi-dev tcl-dev tk-dev
@dimoreira
dimoreira / colors.sh
Created June 24, 2014 04:42
colors.sh
#!/usr/bin/env bash
for i in {0..255} ; do
printf "\x1b[38;5;${i}mcolour${i}\n"
done
@dimoreira
dimoreira / url_rating.js.coffee
Last active August 29, 2015 14:06
Conditional to show rating modal
$ ->
url = window.location.href;
# example url: https://www.example.com.br/users/123
urlPattern = /https:\/\/www.url.com.br\/users\/\d+/g;
if (url.match(urlPattern))
console.log 'Url match: show modal'
else
console.log 'Don\'t match'
@dimoreira
dimoreira / password.js
Created July 26, 2017 05:00 — forked from soplakanets/password.js
Password hashing for node.js
var crypto = require('crypto');
var SaltLength = 9;
function createHash(password) {
var salt = generateSalt(SaltLength);
var hash = md5(password + salt);
return salt + hash;
}