Skip to content

Instantly share code, notes, and snippets.

View larsxschneider's full-sized avatar

Lars Schneider larsxschneider

View GitHub Profile
@larsxschneider
larsxschneider / github.com.js
Created October 31, 2012 17:25 — forked from agnoster/github.com.js
View/edit a file in a pull request by clicking on the line number.
/**
* 1) Use http://defunkt.io/dotjs/
* 2) Install this into ~/.js/github.com.js
* 3) Click on a line number in the editor to open the file at this position (e.g. to see more context)
* 4) Alt+Click on a line number in the editor to edit the file at this position
*
* This script is based on @agnoster's idea: https://gist.github.com/3906361
*/
function getBranch() {
@larsxschneider
larsxschneider / .git-fix-whitespaces.sh
Created October 26, 2012 08:30 — forked from torsten/fix-whitespace.sh
Pre-commit hook script for git to fix various source file things.
#!/bin/sh
# Pre-commit hook for git which removes trailing whitespace, converts tabs to spaces, and enforces a max line length.
# The script does not process files that are partially staged. Reason: The `git add` in the last line would fully
# stage a file which is not what the user wants.
if git rev-parse --verify HEAD >/dev/null 2>&1 ; then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904