See http://jordan.broughs.net/archives/2014/09/provide-separate-rails-log-files-for-each-unicorn-worker
View DefaultKeyBinding.dict
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
View Git branch bash autocomplete *with aliases*
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To Setup: | |
# 1) Save the .git-completion.bash file found here: | |
# https://github.com/git/git/blob/master/contrib/completion/git-completion.bash | |
# 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 |
View google-url-shortener-bookmarklet.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Step 1: Get an API key here: https://developers.google.com/url-shortener/v1/getting_started#APIKey | |
// Step 2: Paste your api key below | |
// Step 3: Add the code below to your browser as a bookmark | |
// Step 4: Visit a non-goo.gl URL and click your bookmark | |
// NOTE: The security policy of some sites (such as this gist.github.com!) will prevent this from working. | |
// Check your javascript console if something doesn't work. | |
javascript:(function(){ | |
var googleApiKey = 'INSERT YOUR API KEY HERE'; |
View puts_methods.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module PutsMethods | |
module_function | |
# prints out methods in a pretty way. e.g.: | |
# >> PutsMethods "asdf" | |
# String | |
# <=>, ==, ===, eql?, hash, casecmp, ... | |
# Comparable | |
# >, >=, <, <=, between? | |
# ... | |
def puts(object, type: 'public') |
View parallel_processor.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParallelProcessor | |
attr_accessor :pid_params | |
def initialize | |
@pid_params = {} | |
end | |
def spawn_worker(start, finish, writer) | |
pid = fork do | |
puts "worker working on #{start} to #{finish}" |
View sandbox.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
cd ~/repos/spree | |
bundle install --quiet 1> /dev/null || bundle update --quiet | |
bundle exec rake sandbox |
View git-recent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Source: https://gist.github.com/jordan-brough/48e2803c0ffa6dc2e0bd | |
# See also: https://stackoverflow.com/a/25095062/58876 | |
# 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
View compliments.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from https://gist.github.com/jordan-brough/fc085fa50f520ef022c9 | |
# inspired by http://emergencycompliment.com/ | |
function emergency_compliment { | |
ruby <<RUBY | |
require "rubygems" | |
require "json" | |
today = Time.now.strftime('%Y-%m-%d') | |
today_filename = "/tmp/compliments-#{today}.json" | |
latest_filename = "/tmp/compliments-latest.json" | |
json = if File.exist?(today_filename) |
NewerOlder