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
# Really dumb script to fix up whitespace but only on the lines changed in the current | |
# commit. Run this script from your $PROJECT/.git/hooks/pre-commit | |
# | |
git diff HEAD --no-color > /tmp/stage.diff | |
git apply -R /tmp/stage.diff | |
git apply --whitespace=fix /tmp/stage.diff |
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
# Really dumb script to fix up whitespace but only on the lines changed in the current | |
# commit. Run this script from your $PROJECT/.git/hooks/pre-commit | |
# | |
git diff HEAD --no-color > /tmp/stage.diff | |
git apply -R /tmp/stage.diff | |
git apply --whitespace=fix /tmp/stage.diff |
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
# Find the pull request that introduced a given commit | |
COMMIT=c78f9ef # just an example commit id | |
# This will list the first few branches that contain this commit (including only "pull request" branches) | |
git branch -r --contains $COMMIT |grep "origin/pr" |sort |head |
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
javascript: (function () { | |
$("label").prepend(function () { | |
if ($("abbr sup", this).length === 0) { | |
var annotation = $("<sup>", { "text": $(this).attr("for"), | |
"style": "color: red" }); | |
return $("<abbr>").append(annotation); | |
} | |
}) | |
})(); |
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
#You Only Leak Once | |
# Install valgrind using one of the following | |
brew install valgrind | |
sudo apt-get install vagrind | |
# make sure valgrind is enabled in your ruby build | |
CONFIGURE_OPTS="--with-valgrind" rbenv install 2.0.0-p0 | |
# control test (should not show any memory leaks) |
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
(defclass venue (validatable) | |
((zip :col-type string :initarg :zip :accessor zip) | |
(phone :col-type string :initarg :phone :accessor phone) | |
(website :col-type (or db-null string) :initarg :website :accessor website)) | |
(:metaclass pomo:dao-class) | |
(:keys id)) | |
(defvalidators venue () | |
(website (start-with "https://")) | |
(phone (match "(\\d\\d\\d)-\\d\\d\\d-\\d\\d\\d")) |
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
MUM=["mom", "mommy", "mother", "mama"] | |
loop do | |
puts MUM.sample | |
sleep(1) | |
end |
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
# Script to review code in the order specified by Dougo on where_web. If you | |
# prefer a different order just rearrange the order of "git diffs", and maybe | |
# alter the definition of "ordered_files" if you actually add or remove a step | |
# | |
# It assumes you've checked out a local copy of the pull request and are | |
# comparing that with develop. | |
# | |
BASE=develop | |
HEAD=HEAD |
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
# Helper script for anyone that has to review Ken's massive pull requests | |
# | |
# Usage: | |
# 0. Save this file as ~/bin/code-review, make it executable and put it in your $PATH | |
# 1. Use https://gist.github.com/3342247 to get a local copy of the PR | |
# 2. Save this as ~/bin/code-review | |
# 3. $ git checkout pr/foo | |
# 4. $ git diff develop.. --oneline |code-review | |
# |
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
ps -ef |grep long-running-proc | |
502 6536 5782 0 21:02 pts/8 00:00:07 long-running-proc | |
kill -s SIGCONT 6536 |