Skip to content

Instantly share code, notes, and snippets.

@bkemper
bkemper / gist:431a74c123debc3bb928
Created January 20, 2015 18:59
Rake task with editor input
task :with_editor do
require "tempfile"
temp_file = Tempfile.new("notes")
unless editor = ENV["EDITOR"]
abort "Please define your editor."
end
# Open editor
system("#{editor} #{temp_file.path}")
@bkemper
bkemper / gist:f3feea7dcbf4b513071e
Last active September 15, 2015 18:34
Key management with OS X Keychain
# Too often developers leave keys in unencrypted files (e.g. bash_profile).
# The following are instructions to show how easy it is to create a new keychain
# for your project and fetch the keys.
# Create a keychain for your project
$ security create-keychain <your-project-name>.keychain
# Add keychain to search list (optional)
#
# @note The -s argument sets the list. If you have other keychains, you must

Keybase proof

I hereby claim:

  • I am bkemper on github.
  • I am kemper (https://keybase.io/kemper) on keybase.
  • I have a public key ASC99d4a3K26BmZY1SleTE0rPtssrTML9li3LUBykqyqjwo

To claim this, I am signing this object:

@bkemper
bkemper / install
Last active January 3, 2017 01:27
Instructions to configure Pound for lvh.me
#!/usr/bin/env bash
if [ -z "$(which brew)" ]; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
if [ -z "$(which pound)" ]; then
brew install pound # http://brewformulas.org/Pound
fi
@bkemper
bkemper / gist:ecb6d7a04a56d5222b9f1d3687fa8080
Created September 8, 2016 10:55
Script to "Not Watch" all your organizations repositories
# Simple utility script to "Not Watch" all the repositories in your GitHub
# organization
#
# @example
# $ GITHUB_ACCESS_TOKEN=MYACCESSTOKEN ruby stop_watching.rb staqapp
require "faraday"
require "json"
NO_CONTENT = 204
@bkemper
bkemper / ruby-block_strings.md
Last active June 14, 2017 14:58
Dear Ruby, what about a squished block string?

Ruby supports a number of ways to define a block/multiline string.

  • Concatenation
  • Heredocs
  • Join an array of strings
  • Quotes
  • Shorthand

Here are some explanations:

@bkemper
bkemper / gist:ca6ac68b174a047b5ccde3930c8568dc
Last active December 7, 2021 19:28
How to edit a commit with interactive rebase

While on a branch with a couple of commits, you can edit a commit with interactive rebase. This should be used sparingly and only on branches and never on master.

  1. Checkout the branch

$ git checkout my-branch

  1. Get the ref of the commit that you want to edit from the commit log. (e.g. 67b191fc62eda52b5b208cc4de50df7144a03171)

$ git log

@bkemper
bkemper / a_ferdinand.md
Last active April 3, 2018 13:52
Ferdinand

Ferdinand

An unpacked Chrome extension that injects a script, waits a minute, and then throws an Error.

How to use me?

  1. Download or clone me, git clone https://gist.github.com/4c1e9a87f4b0b921711ea6791c265cc0.git
  2. Open chrome://extensions/
  3. Click "Load Unpacked"
  4. Select the "4c1e9a87f4b0b921711ea6791c265cc0" directory