Skip to content

Instantly share code, notes, and snippets.

View renatoalbano's full-sized avatar

Renato Albano renatoalbano

View GitHub Profile
@renatoalbano
renatoalbano / git-head-files.sh
Created October 24, 2016 16:58
snip: open each file edited on last commit on vim tab
# open each file edited on last commit on vim tab
# git show head --name-only --oneline -> show files
# tail -n +2 -> cut first line (commit hash)
# tr '\n' ' ' -> replace break line to space
# vi -p open each file (space sep) on tab
vi -p $(git show head --name-only --oneline | tail -n +2 | tr '\n' ' ')
@renatoalbano
renatoalbano / encode_uri_rfc3986.erl
Created September 27, 2012 21:06
erlang percent encoding that works with utf-8
-module(encode_uri_rfc3986).
-author('Renato Albano <renatoalbano@gmail.com>').
-export([encode/1]).
%% Taken from <http://erlangexamples.com/>,
%% from <http://github.com/CapnKernul/httparadise>
%% and <http://www.erlang.org/doc/man/edoc_lib.html>
encode([C | Cs]) when C >= $a, C =< $z ->
@renatoalbano
renatoalbano / sinatra-twitter-oauth-client.rb
Created November 5, 2009 22:36
sinatra twitter client with oauth
# sinatra twitter client with oauth
require 'rubygems'
require 'sinatra'
# use http://github.com/moomerman/twitter_oauth gem
# gem sources -a http://gems.github.com
# gem install moomerman-twitter_oauth
require 'twitter_oauth'
/****
RFC822 Email Address Regex
Translated to Javascript by Renato Albano
http://tfletcher.com/lib/rfc822.rb
http://iamcal.com/publish/articles/php/parsing_email/
Licensed under a Creative Commons Attribution-ShareAlike 2.5 License
-module(mod_iqtest).
-behaviour(gen_mod).
-export([
start/2, stop/1,
process_sm_iq/3
]).
-include("ejabberd.hrl").
-include("jlib.hrl").
@renatoalbano
renatoalbano / gist:63002
Created February 13, 2009 02:16
How Not To Sort By Average Rating
# How Not To Sort By Average Rating
# url: http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
# lib: http://blade.nagaokaut.ac.jp/~sinara/ruby/math/statistics2/ (need compile)
# statistics2 disabled
#require 'statistics2'
def ci_lower_bound(pos, n, power)
if n == 0
return 0