View .bash_profile
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
__quiet() { | |
$1 2> /dev/null | |
} | |
parse_git_branch() { | |
__quiet 'git branch' | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
count_git_changes() { | |
count=$(__quiet 'git status -s' | wc -l) |
View quinky.rb
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 'json' | |
require 'typhoeus' | |
require 'ansi' | |
ACCESS_TOKEN = # | |
GROUP_ID = # | |
def register_bot(name, avatar_url=nil) | |
url = "https://api.groupme.com/v3/bots?token=#{ACCESS_TOKEN}" | |
body = { |
View gist:767098
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
def self.volatility(prices) | |
mean = (prices.inject {|s,n| s+n}) / prices.length | |
sd = Math.sqrt((prices.inject(0) {|s,n| s + (n-mean)*(n-mean)}) / (prices.length-1)) | |
rsd = sd/mean*100 | |
('%.2f'%rsd) | |
end |
View gist:767168
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
def run(&block) | |
begin; yield; rescue => e; Error.report(e); end | |
end |
View .profile
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
gemopen() { | |
gem_dir=( $(find $GEM_HOME/gems -maxdepth 1 | grep $1) ) | |
for line in ${!gem_dir[*]}; do | |
echo $(($line + 1)). ${gem_dir[$line]} | |
done | |
if [ ${#gem_dir[*]} == 0 ]; then | |
echo $1 directory not found. | |
else | |
echo -e '> \c' | |
read inpt |
View gist:1217912
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
module Breadcrumbs | |
def self.included(mod) | |
mod.extend ClassMethods | |
mod.class_variable_set :@@__defined_methods, [] | |
end | |
module ClassMethods | |
def method_added(m) | |
unless (meths = class_variable_get(:@@__defined_methods)).include?(m) |
View gist:1219522
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
__quiet() { | |
$1 2> /dev/null | |
} | |
parse_git_branch() { | |
__quiet 'git branch' | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
count_git_changes() { | |
count=$(__quiet 'git status -s' | wc -l) |
View .profile
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
gemopen() { | |
gem_dir=( $(find $GEM_HOME/gems -maxdepth 1 | grep $1) ) | |
dir_count=${#gem_dir[*]} | |
if [ $dir_count == 0 ]; then | |
echo $1 directory not found. | |
elif [ $dir_count == 1 ]; then | |
mate ${gem_dir[0]} | |
else | |
for line in ${!gem_dir[*]}; do | |
echo $(($line + 1)). ${gem_dir[$line]} |
View gist:1282702
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
# Orig | |
def items options = Hash.new | |
products = true_category.descendant_products.available.visible | |
if options[:vendor] | |
products = products.by_vendor options[:vendor] | |
end | |
if options[:factor] |
View gist:1284489
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
> def a(x,y); end | |
=> nil | |
> send :a, [1,2] | |
ArgumentError: wrong number of arguments (1 for 2) | |
from (irb):1:in `a' | |
from (irb):2 | |
from /Users/bhundley/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>' | |
> send :a, *[1,2] | |
=> nil |
OlderNewer