Skip to content

Instantly share code, notes, and snippets.


Jordan Brough jordan-brough

View GitHub Profile
jordan-brough / git-recent
Last active Nov 10, 2022
Git: Display a list of recently checked out branches/tags/commits
View git-recent
#!/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:
jordan-brough / gist:1926410
Created Feb 27, 2012
ruby count_by using group_by
View gist:1926410
# See
# Ruby >= 1.8.7 (incl 1.9.x)
module Enumerable
def count_by(&block)
Hash[group_by(&block).map { |key,vals| [key, vals.size] }]
View puts_methods.rb
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 / instructions.markdown
Created Nov 3, 2012
Splunk-friendly timestamp plugin snippet for Sublime Text 2
View instructions.markdown
  1. Choose: Tools > New Plugin

  2. Paste in the contents of "" below

  3. Save as in ~/Library/Application Support/Sublime Text 2/Packages/User/ (should be the default directory that pops up when you save)

  4. Choose: Sublime Text 2 > Preferences > Key Bindings - User

  5. Add:

    { "keys": ["super+ctrl+t"], "command": "timestamp" }

To make command+ctrl+t perform the insertion.
Make sure to add a comma after the previous keymap entry, if present.

View google-url-shortener-bookmarklet.js
// 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';
jordan-brough / DefaultKeyBinding.dict
Last active Jul 11, 2018
MacOS checkmark keybinding
View DefaultKeyBinding.dict
// 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 Apr 26, 2018 — forked from JuggoPop/Git branch bash autocomplete *with aliases*
Git branch bash autocomplete *with aliases* (add to .bash_profile)
View Git branch bash autocomplete *with aliases*
# 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 / gist:3452180
Created Aug 24, 2012
Extend splunk saved search TTL to 1 year
View gist:3452180
# 31536000 == 1 year (365 days) in seconds
curl -u <USERNAME>:<PASSWORD> --insecure https://<SPLUNK_URL>:8089/services/search/jobs/<JOB_ID>/control -d action=setttl -d ttl=31536000; echo
View github_dashboard_twitter.user.js
// ==UserScript==
// @name GitHub Dashboard Twitter
// @namespace
// @include
// ==/UserScript==
$(" h1").before(
$("<div>").attr("id", "twitter_div2").append(
$("<h1>").text("GitHub status ").css({