This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pp' | |
class Array | |
def average | |
inject(0.0) { |sum, e| sum + e } / length | |
end | |
end | |
res = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/expect | |
# Debug info | |
# exp_internal 1 | |
set timeout 10 | |
log_user 0 | |
set path [lindex $argv 0] | |
if {[llength $argv] == 0} { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Security | |
attr_reader :app, :service | |
def initialize(app, service = app) | |
@app = app | |
@service = service | |
end | |
def get_password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# >---------------------------------------------------------------------------< | |
# | |
# _____ _ _ | |
# | __ \ (_) | /\ | |
# | |__) |__ _ _| |___ / \ _ __ _ __ ___ | |
# | _ // _` | | / __| / /\ \ | '_ \| '_ \/ __| | |
# | | \ \ (_| | | \__ \/ ____ \| |_) | |_) \__ \ | |
# |_| \_\__,_|_|_|___/_/ \_\ .__/| .__/|___/ | |
# | | | | | |
# |_| |_| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; real-auto-save.el --- enable real auto save | |
;; Copyright (C) 2008, Chaoji Li | |
;; Author: Chaoji Li <lichaoji AT gmail DOT com> | |
;; Version: 0.3 | |
;; Date: May 17, 2008 | |
;; This file is free software; you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
# -*- mode: shell-script; -*- | |
current_branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') | |
if [ "$current_branch" != "master" ]; then | |
echo "WARNING: You are on branch $current_branch, NOT master." | |
fi | |
echo "Fetching merged branches..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(add-to-list 'hs-special-modes-alist | |
`(coffee-mode "\\s-*\\(?:class\\|.+[-=]>$\\)" nil "#" | |
,(lambda (arg) | |
(coffee-nav-end-of-block)) nil)) | |
(defun coffee-chomp (str) | |
"Chomp leading and tailing whitespace from STR." | |
(while (string-match "\\`\n+\\|^\\s-+\\|\\s-+$\\|\n+\\'" | |
str) | |
(setq str (replace-match "" t t str))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /usr/local/etc/bash_completion.d | |
for f in * | |
do | |
if [[ $f =~ git|helpers ]]; then | |
echo "MATCH" | |
fi | |
exists=$(which $f) | |
if [[ -z $exists ]]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IFS=$'\n' | |
# Find all leaf directories | |
for dir in $(find . -type d -exec sh -c '(ls -p "{}"|grep />/dev/null)||echo "{}"' \;); | |
do | |
cd $dir | |
find . -type f -iname '*mp3' | sed s/\.\\/// > "$(echo $dir | sed s/.*\\///)"-playlist.m3u | |
cd - | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
complete -C `which xing_autocompletion` -o default xing | |
xing_dir="/Users/jorge.dias/development/xing" | |
function cx () { | |
if [ -n $1 ]; then | |
cd "$xing_dir/$1" | |
else | |
cd $xing_dir | |
fi |