Skip to content

Instantly share code, notes, and snippets.

View BrianMehrman's full-sized avatar
🏠
Working from home

Brian Mehrman BrianMehrman

🏠
Working from home
View GitHub Profile
require 'benchmark/ips'
module ExtraMath
def self.build_math(attr_name)
attr_name = attr_name.to_s
class_eval %Q{
def #{attr_name}(x)
x + x
end
}
# ------------------------------------
# Open Browser to URL
# ------------------------------------
unset gd
gdCall(){
unalias gd
open "http://bringvictory.com/"
if [[ "$#" -ge 1 ]]; then
echo "wat"
@BrianMehrman
BrianMehrman / git_branch_prompt
Created October 14, 2014 15:58
git branch in bash prompt
# ----------------------------------------------------------------------
# PROMPT
# ----------------------------------------------------------------------
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/(\1$(parse_git_dirty))/"
}
@BrianMehrman
BrianMehrman / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@BrianMehrman
BrianMehrman / BeerSong.rb
Last active December 26, 2015 04:39
Make a Beer Songex. BeerSong.rb 100
limit = ARGV[0].to_i
limit.times {|i| system "say #{limit-i} bottles of beer on the wall, #{limit-i} bottles of beer. Take one down, pass it around, #{limit-(i+1)} bottles of beer on the wall."}