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 / git-recent
Last active November 29, 2023 17:18
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:
View gist:15d1bfc2378a36a1a2a1
# 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 / google-url-shortener-bookmarklet.js
Created November 22, 2017 16:48 URL shortener bookmarklet
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 / gist:1926410
Created February 27, 2012 19:14
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 November 3, 2012 13:50
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.

jordan-brough / DefaultKeyBinding.dict
Last active July 11, 2018 18:27
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 April 26, 2018 13:07 — 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 August 24, 2012 15:48
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