Skip to content

Instantly share code, notes, and snippets.

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

Luiz Aguiar laguiar

🏠
Working from home
View GitHub Profile
@laguiar
laguiar / gist:122644
Created June 2, 2009 22:44
Get all images from a URL
require 'rubygems'
require 'hpricot'
require 'net/http'
require 'open-uri'
site = "http://www.globo.com"
html = Hpricot.XML(open(site))
images = html.search("//img").each do |img|
img_addr = img.get_attribute("src")
img_addr = site + img_addr if img_addr.slice(0..0) == "/"
.DS_Store
.idea
log/*
tmp/*
db/*.sqlite3
@laguiar
laguiar / .gitconfig
Created November 13, 2009 04:26
.gitconfig
[user]
email = luiz.aguiar@gmail.com
name = Luiz Aguiar
[github]
user = laguiar
token = <token_here>
[alias]
st = status
ci = commit -am
br = branch
@laguiar
laguiar / .bash_profile
Created November 13, 2009 18:58
.bash_profile (mac)
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
# GIT
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
# mongodb-template.rb
#
# To use:
# rails <your_project_name> -m http://gist.github.com/gists/293969.rb
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/*"
http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastSuccessfulBuild/artifact/nbbuild/nbms/updates.xml.gz
# Aloha theme
http://www.pasopas.nl/2010/03/netbeans-6-8-aloha-theme-extra-ruby-themes/
@laguiar
laguiar / convert_hash_to_params.rb
Created July 2, 2010 17:58
Convert a Hash to HTTP params
ActionController::Routing::Route.new().build_query_string(hash)
'1123.1234.455-123'.gsub(/\./, '').gsub(/-/, '')
<master_branch>$ git checkout work
<work_branch> $ git remote add new_remote git@github.com:repo/project.git
<work_branch> $ git fetch new_remote
<work_branch> $ git checkout --track -b merge_branch new_remote/master
<merge_branch> $ git merge work
env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config