Skip to content

Instantly share code, notes, and snippets.

Jeremy Friesen jeremyf

Block or report user

Report or block jeremyf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:132166
name = Jeremy Friesen
email =
branch = auto
diff = auto
status = auto
[color "branch"]
current = red reverse
local = red bold
View git aliases for github
# Two spiffy github commands. One is to go to the appropriate branch
# The other is to open up the issues, allowing for passing a param and opening
# the specific issue
# Open the current branch on github
hub = "! br=$(git branch --contains HEAD | sed -En \"s/^\\* //p\"); if ! git ls-remote . | grep -q -e \"refs/remotes/.*/${br}\"; then br=\"master\"; fi; open $(git config -l | sed -En \"s%remote.origin.url=git(@|://)(|/)(.+/.+).git%https://\\2/\\4/tree/${br}%p\")"
# Go to the github project's issues
# $ git hub-issue
# => open browser and go to project's issues
View Protected methods
class Foo
class << self
def bar; 'class bar'; end
protected :bar
def bar; 'instance bar'; end
if $0 == __FILE__
jeremyf / snippet.rb
Created Feb 12, 2010
Compare two files
View snippet.rb
require 'pathname'
# Compares two files for "similar" look, ignoring
# where elements are in the document.
def collect_unique_lines(*args)
dir ='tmp'))
contents ='.'))).split("\n")
lines = []
# proposed_lines = []
contents.inject(lines) {|mem,string|
# bash completion support for core Git.
# Copyright (C) 2006,2007 Shawn O. Pearce <>
# Conceptually based on gitcompletion (
# Distributed under the GNU General Public License, version 2.0.
# The contained completion routines provide support for completing:
View snippet.txt
# ~/.gitconfig
# Open the current branch on github
hub = "! br=$(git branch --contains HEAD | sed -En \"s/^\\* //p\"); if ! git ls-remote . | grep -q -e \"refs/remotes/.*/${br}\"; then br=\"master\"; fi; open $(git config -l | sed -En \"s%remote.origin.url=git(@|://)(|/)(.+/.+).git%https://\\2/\\4/tree/${br}%p\")"
# Go to the lighthouse project, your config will need to have set the subdomain and project
# If branch begins with a number (0-9), then open that ticket # in Lighthouse
# Otherwise, go to milestones/current
lighthouse = "! ref=\"milestones/current\"; ticket=$(git branch --contains HEAD | sed -En \"s/^\\* //p\" | grep -e \"^[0-9]\" | awk '{print \"tickets/\"$1}'); if [[ -n \"${ticket}\" ]]; then ref=\"${ticket}\"; fi; open https://$(git config lighthouse.subdomain)$(git config lighthouse.project)/${ref}"
View kcpassword
# Thank you Gavin Brock ( - June 2007
use strict;
use warnings;
use Foundation;
View gist:412672
# I need class C to call the foo method for each module included
# that has the method foo. Order does not matter as much as each
# method getting called. alias method chain?
module ChainMethod
def chain_method(method_name)
base_method = instance_method(method_name.to_sym)
chained_method = included_modules.inject([base_method]) do |mem, mod|
if method = (mod.instance_methods.include?(method_name.to_s) ? mod.instance_method(method_name.to_sym) : nil)
mem << method
jeremyf / wp2bgg.rb
Created Jan 12, 2012
A simple script to do some of the heavy lifting for moving Wordpress reviews to BoardGameGeek
View wp2bgg.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'highline/import'
require 'open-uri'
conversions = [
["<blockquote>", '[q]' ],
["</blockquote>", '[/q]' ],
jeremyf / .rvmrc
Created Mar 21, 2012
.rvmrc file that is a shell script; From Object on Rails
View .rvmrc
#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
# Uncomment following line if you want options to be set only for given project.
You can’t perform that action at this time.