Skip to content

Instantly share code, notes, and snippets.

View tiagopog's full-sized avatar

Tiago Guedes tiagopog

View GitHub Profile
@tiagopog
tiagopog / array.rb
Created May 9, 2014 16:32
Some useful array methods.
# Add some useful methods to the Ruby Array class.
# For Rails, add this class into the "initializers" folder:
# config/initializers/array.rb
class Array
# Group the array's elements.
#
# Arguments:
# r: (Integer)
# - Max amount of elements each array's subgroup will have.
def arrange(r)
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" TODO: this may not be in the correct place. It is intended to allow overriding <Leader>.
" source ~/.vimrc.before if it exists.
if filereadable(expand("~/.vimrc.before"))
source ~/.vimrc.before
endif
let g:yadr_using_unsolarized_terminal = 1
var koa = require('koa'),
app = module.exports = koa(),
route = require('koa-route');
// x-response-time
app.use(function *(next){
var start = new Date;
yield next;
var ms = new Date - start;
this.set('X-Response-Time', ms + 'ms');
@tiagopog
tiagopog / .rspec
Last active August 29, 2015 14:08
.rspec
--color
--format=documentation
@tiagopog
tiagopog / .gitignore
Last active August 29, 2015 14:08
.gitignore
/.bundle
/db/*.sqlite3
/db/*.sqlite3-journal
/log/*.log
/tmp
.swp
.rspec
Guardfile
@tiagopog
tiagopog / .env.example
Last active August 29, 2015 14:09
.env.example
# ==== Required configuration settings ====
# Replace the following with the output from "rake secret"
APP_SECRET_TOKEN=REPLACE_ME_NOW!
# This is the domain where your instance will be running
DOMAIN=localhost:3000
# Optionally set an asset host
# ASSET_HOST=http://assets.example.com
@tiagopog
tiagopog / Gemfile
Last active August 29, 2015 14:10
Basic Gemfile for Rails APIs
source 'https://rubygems.org'
gem 'rails', '4.1.8'
# infrastructure
gem 'dotenv-rails', groups: [:development, :test]
gem 'puma'
gem 'pg'
# backend
@tiagopog
tiagopog / database.yml
Last active August 29, 2015 14:10
database.yml
default: &default
adapter: <%= ENV['DATABASE_ADAPTER'] %>
pool: <%= ENV['DATABASE_POOL'] %>
timeout: <%= ENV['DATABASE_TIMEOUT'] %>
encoding: <%= ENV['DATABASE_ENCODING'] %>
host: <%= ENV['DATABASE_HOST'] %>
username: <%= ENV['DATABASE_USERNAME'] %>
password: <%= ENV['DATABASE_PASSWORD'] %>
development:
@tiagopog
tiagopog / .tmux.conf
Last active August 29, 2015 14:13
.tmux.conf
# Ring the bell if any background window rang a bell
set -g bell-action any
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color
# Keep your finger on ctrl, or don't
bind-key ^D detach-client
# Create splits and vertical splits