Skip to content

Instantly share code, notes, and snippets.

View chubas's full-sized avatar

Rubén Medellín chubas

View GitHub Profile
# Configure colors, if available.
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
c_reset='\[\e[0m\]'
c_user='\[\e[0;32m\]'
c_path='\[\e[1;34m\]'
c_git_clean='\[\e[0;37m\]'
c_git_staged='\[\e[0;32m\]'
c_git_unstaged='\[\e[0;31m\]'
else
c_reset=

The following document attempts to define a legend for easy specification of APIs for components. Any suggestions to improve are welcome.

Class Members
   + class property
   - instance property
  ~> listened events (socket)
  +> listened events (class/module)
  -> listened events (instance)
  <~ dispatched events (socket)
@chubas
chubas / .gitignore
Last active August 31, 2015 19:40 — forked from kleber-swf/.gitignore
# =============== #
# Unity generated #
# =============== #
[Tt]emp/
[Oo]bj/
[Bb]uild
[Ll]ibrary/
sysinfo.txt
# ===================================== #
@chubas
chubas / gist:477067
Created July 15, 2010 15:04
Show git branch name in terminal
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
@chubas
chubas / gist:551799
Created August 26, 2010 17:16
Twitter status sanity
require 'json'
require 'net/http'
require 'uri'
status = JSON.parse Net::HTTP.get(URI.parse("http://api.twitter.com/1/account/rate_limit_status.json"))
red, green, reset = "\e[31m", "\e[32m", "\e[0m"
wait = (Time.at(status["reset_time_in_seconds"].to_i) - Time.now).to_i
if (hits = status["remaining_hits"]).zero?
puts "#{red}Oops#{reset}, seems you have to wait another #{red}#{wait / 60} mins, #{wait % 60} secs#{reset}."
else
@chubas
chubas / uncompress function
Created September 20, 2010 20:50 — forked from codingpains/bash extract function
GunTarUntarRarBunZipWaitWhat
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
@chubas
chubas / gist:646101
Created October 26, 2010 00:43
WTF arithmetics
t = Time.now
wtf = 2.years
puts wtf.to_i #=> 63115200
puts ((t + wtf) - t).to_i #=> 63158400
*** glibc detected *** ruby: double free or corruption (fasttop): 0x10922a48 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0x63a0d1]
/lib/tls/i686/cmov/libc.so.6[0x63b7d2]
/lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0x63e8ad]
ruby(ruby_xfree+0x26)[0x8073316]
/usr/lib/libxml2.so.2(xmlFreeNodeList+0x166)[0xe0b886]
/usr/lib/libxml2.so.2(xmlFreeNodeList+0x84)[0xe0b7a4]
/usr/lib/libxml2.so.2(xmlFreeNodeList+0x84)[0xe0b7a4]
/usr/lib/libxml2.so.2(xmlFreeDoc+0xc2)[0xe0b5e2]
@chubas
chubas / gist:706023
Created November 19, 2010 02:03
Assorted Linux Commands
#===== Video
ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg
#===== Audio
# Start timidity port
timidity -iA -B0 -Os -EFreverb=0
@chubas
chubas / stretto-example.rb
Created March 8, 2011 16:47
Stretto documentation - example snippet
require 'stretto'
player = Stretto::Player.new('C C G G | A A Gh | F F E E | D D Ch')
player.play