Skip to content

Instantly share code, notes, and snippets.

View jordan-brough's full-sized avatar

Jordan Brough jordan-brough

View GitHub Profile
jordan-brough / DefaultKeyBinding.dict
Last active April 9, 2024 16:29
MacOS checkmark keybinding
// Installation:
// 1. Save this file as /Users/YOUR_USER_NAME_HERE/Library/KeyBindings/DefaultKeyBinding.dict
// 2. Log out and log back in (or just restart any app where you'd like to use the shortcut)
// What: Keyboard shortcut to easily insert checkmarks. (Or whatever text you'd like to insert).
// By default option+v in MacOS inserts a square-root symbol: √
// I've often used option+v as a quick-and-dirty checkmark. This shortcut lets me get a real checkmark.
// Insert a checkmark with option+v
jordan-brough / Git branch bash autocomplete *with aliases*
Created April 26, 2018 13:07 — forked from JuggoPop/Git branch bash autocomplete *with aliases*
Git branch bash autocomplete *with aliases* (add to .bash_profile)
# To Setup:
# 1) Save the .git-completion.bash file found here:
# 2) Add the following lines to your .bash_profile, be sure to reload (for example: source ~/.bash_profile) for the changes to take effect:
# Git branch bash completion
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
# Add git completion to aliases
jordan-brough / google-url-shortener-bookmarklet.js
Created November 22, 2017 16:48 URL shortener bookmarklet
// Step 1: Get an API key here:
// Step 2: Paste your api key below
// Step 3: Add the code below to your browser as a bookmark
// Step 4: Visit a URL and click your bookmark
// NOTE: The security policy of some sites (such as this!) will prevent this from working.
// Check your javascript console if something doesn't work.
var googleApiKey = 'INSERT YOUR API KEY HERE';
module PutsMethods
# prints out methods in a pretty way. e.g.:
# >> PutsMethods "asdf"
# String
# <=>, ==, ===, eql?, hash, casecmp, ...
# Comparable
# >, >=, <, <=, between?
# ...
def puts(object, type: 'public')
jordan-brough / parallel_processor.rb
Last active August 29, 2015 14:06
Ruby parellel processing and inter-process messaging with fork
class ParallelProcessor
attr_accessor :pid_params
def initialize
@pid_params = {}
def spawn_worker(start, finish, writer)
pid = fork do
puts "worker working on #{start} to #{finish}"
jordan-brough /
Last active August 29, 2015 14:05
customized spree sandbox
#!/usr/bin/env bash
set -e
cd ~/repos/spree
bundle install --quiet 1> /dev/null || bundle update --quiet
bundle exec rake sandbox
jordan-brough / git-recent
Last active April 8, 2024 02:53
Git: Display a list of recently checked out branches/tags/commits
#!/usr/bin/env bash
# Source:
# See also:
# Download this script as "git-recent" (no extension), chmod it to be executable and put it in your
# path somewhere (e.g. /usr/bin). You can then use it via `git recent` from inside any git repo.
# Examples:
# to always include this in IRB save this to ~/.irbrc.examine and add this to your ~/.irbrc:
# load File.expand_path('../.irbrc.examine', __FILE__)
module JordanBrough
module Examine
module InstanceMethods
def examine(*attrs, printer: :default)
jordan-brough /
Last active August 29, 2015 13:56
Bash compliments when you clear your screen. You deserve it. ;)
# from
# inspired by
function emergency_compliment {
ruby <<RUBY
require "rubygems"
require "json"
today ='%Y-%m-%d')
today_filename = "/tmp/compliments-#{today}.json"
latest_filename = "/tmp/compliments-latest.json"
json = if File.exist?(today_filename)