Skip to content

Instantly share code, notes, and snippets.

View sauron's full-sized avatar

Pablo Barrios sauron

  • San Miguel de Tucumán, Argentina
View GitHub Profile
# ~/.gemrc
---
:benchmark: false
:verbose: true
:update_sources: true
:sources:
- http://rubygems.org/
:backtrace: false
:bulk_threshold: 1000
@sauron
sauron / .profile
Last active November 8, 2017 19:26
Prompt bash for GIT with branches - rvm - and git status.For Mac OSX it must be put on the ~/.profile fileFor Linux it must be put on the ~/.bash_rc file or similar.Just a note the "nothing to commit,..." message depends of your git version.
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
@sauron
sauron / test_live.html
Created April 5, 2013 01:12
Comparaciones entre live() y on()
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script>
function addClick(){
$("span.clickeable").live("click", function(){
alert("clicked");
})
};
@sauron
sauron / my.zsh-theme
Created June 26, 2013 01:58
Basic zsh theme configuration. Showing the current path, git branch, rvm info Based on robbyrussell ohmyzsh theme
function is_rvm() {
if [[ "$(rvm-prompt)" != "" ]]; then
echo "[%{$fg[red]%}$(rvm-prompt)%{$fg_bold[white]%}]"
fi
}
PROMPT='%{$fg_bold[cyan]%}%c %{$fg_bold[white]%}$(git_prompt_info)%{$fg_bold[white]%}$(is_rvm) %{$fg_bold[cyan]%}• %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="[%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
@sauron
sauron / .gitconfig
Created June 28, 2013 20:03
Git aliases and coloring things
[alias]
up = pull --rebase origin
br = branch
st = status
ci = commit
co = checkout
ql = log --abbrev-commit --pretty=oneline
qlr = log --reverse --abbrev-commit --pretty=oneline
pending = log --reverse --abbrev-commit --pretty=oneline master --cherry-pick master...
undo = reset --soft HEAD^
{
"caret_style": "phase",
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"default_line_ending": "unix",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"fallback_encoding": "UTF-8",
"file_exclude_patterns":
[
"*.pyc",
@sauron
sauron / fibo.rb
Created December 5, 2013 22:37
Fibonacci Loves maths :D
def fibo(n)
root5=Math.sqrt(5)
phi=0.5+(root5/2)
Integer(0.5+phi**n/root5)
end
puts fibo(ARGV.first.to_i)
@sauron
sauron / books_general.rb
Created December 10, 2013 00:04
Acciones especificas para un recurso/miembro en particular. Manejo de sessiones
# config/routes.rb
#agregancdo una accion a un recurso/miembro en particular
resources :books do
member do
put :publish
end
end
# o
put "/books/:id/publish", to: "books#publish"
@sauron
sauron / christmass_tree.rb
Last active December 31, 2015 21:09
What it takes to make a scalable Christmas tree in Ruby?
#Simple tree that will look as an arrow :D
height = 20
((1..height).to_a+[6]*height.div(5)).map do |i|
puts ('*'*i*2).center(80)
end
#Simple tree that look more like a doodle christmas tree
height = 20
(
@sauron
sauron / console_table_test.js
Created January 30, 2014 13:47
Simple example of how to use the console.table() function for data visualization.
// Use of console.table()
var iKnow = [
{ lenguage: "Ruby", level: 10 },
{ lenguage: "Go", level: 5 },
{ lenguage: ".Net", level: 8 },
{ lenguage: "FoxPro", level: 10 }
];
console.table(iKnow);