Skip to content

Instantly share code, notes, and snippets.

@rogerleite
rogerleite / support_to_hal.rb
Created April 24, 2012 19:43
Restfolia: Support to HAL
# Run this sample from root project:
# $ ruby samples/support_to_HAL.rb
require "rubygems"
$LOAD_PATH << "lib"
require "restfolia"
# HAL from http://stateless.co/hal_specification.html
json_hal = <<-JSON
@rogerleite
rogerleite / postinstall.sh
Created March 21, 2012 17:44 — forked from evansd/postinstall.sh
postinstall sript from vagrant example box (having it somewhere web-accessible is easiest way to get it on to newly created VMs)
#!/usr/bin/env bash
# Apt-install various things necessary for Ruby, guest additions,
# etc., and remove optional things to trim down the machine.
apt_get_things()
{
apt-get -y update
apt-get -y remove apparmor
apt-get -y install linux-headers-$(uname -r) build-essential
apt-get -y install zlib1g zlib1g-dev libxml2 libxml2-dev libxslt-dev libssl-dev openssl libreadline5-dev
@rogerleite
rogerleite / dibot.rb
Created February 17, 2012 17:09
Robo xexelento que executa comando
require 'rubygems'
require 'xmpp4r-simple'
# gem install xmpp4r-simple
include Jabber
#Jabber::debug = true
jid = 'email@gmail.com'
pass = 'secret'
@rogerleite
rogerleite / .bash_profile
Created February 1, 2012 15:01
Bash profile do Mac da Abril
alias ls='ls -G'
# brew install bash-completion
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
# Tell grep to highlight matches
export GREP_OPTIONS='--color=auto'
@rogerleite
rogerleite / .gitconfig
Created November 11, 2011 18:37
my .gitconfig file
[url "ssh://git-abril/repos/"]
insteadOf = abril-repo:
[user]
name = Roger Leite
email = roger.barreto+github@gmail.com
[core]
editor = gvim -f
[color]
diff = auto
interactive = auto
(in /home/roger/dev/trivial/temp/raketest)
** Invoke test (first_time)
** Execute test
** Invoke test:units (first_time)
** Invoke test:prepare (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
ENV LOADED !
@rogerleite
rogerleite / myvimrc
Created January 28, 2011 15:49
My .vimrc file
"https://github.com/akitaonrails/vimfiles
"git://github.com/akitaonrails/vimfiles.git
source ~/.vim/vimrc
nnoremap <C-b> :BufExplorer<cr>
nnoremap <C-f> :CommandT<CR>
"disable visual bell for all platforms
if has("autocmd") && has("gui")
@rogerleite
rogerleite / db_utility_belt.rake
Created September 12, 2010 23:08
rake functions
# Database Utils for lazy programmers
namespace :db do
# Simple Mysql Dump Operations
namespace :dump do
def param_filename
filename = ENV["file"] || "db/dump/#{db[:database]}.sql"
filename = "#{Rails.root}/#{filename}" unless filename.starts_with?("/")
filename
begin
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:cucumber) do |t|
t.cucumber_opts = "features --format pretty"
end
namespace :cucumber do
Cucumber::Rake::Task.new(:wip) do |t|
t.cucumber_opts = "features --format pretty -t @wip --wip"
@rogerleite
rogerleite / .irbrc
Created January 13, 2010 15:53
.irbrc
# This irb script enables:
# - irb completion. (Ex: "".[tab] show available methods)
# - commands history. Up and Down arrows to navigate at commands.
# - requires pretty print.
# - if "awesome print" gem is available, replace pp command for ap.
# - if RAILS_ENV exists, set irb console as logger. (I can see queries from ActiveRecord)
require 'irb/completion'
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]