Skip to content

Instantly share code, notes, and snippets.

View rage-shadowman's full-sized avatar

Ralph Jennings rage-shadowman

View GitHub Profile
@fwielstra
fwielstra / pre-push
Last active June 20, 2023 06:38 — forked from strootman/pre-push
A pre-push git hook which runs a gradle test task
#!/bin/sh
# this hook is in SCM so that it can be shared
# to install it, create a symbolic link in the projects .git/hooks folder
#
# i.e. - from the .git/hooks directory, run
# $ ln -s ../../git-hooks/pre-commit.sh pre-commit
#
# to skip the tests, run with the --no-verify argument
# i.e. - $ 'git commit --no-verify'
@borgand
borgand / git-merge-svn
Last active January 7, 2019 06:44
A helper script to set *svn:mergeinfo* property when using `git svn dcommit` on merged git branches.This makes it possible to merge two SVN branches using **git-svn**.NB! the merged-from branch **MUST** be pushed to SVN.USAGE: git merge-svn <branch name>EDIT: added exit condition when mergeinfo calculation fails to avoid pushing incomplete merge…
#!/bin/bash
function usage {
echo "USAGE: git merge-svn <from> [<to>]"
echo ""
echo " from The branch name to be merged FROM"
echo " to Optional branch name to be merged onto. Default: HEAD"
echo ""
}
@brundage
brundage / decimal_arithmetic.js
Created May 18, 2012 13:28
Problematic Decimal Arithmetic in Javascript
// decimal_arithmetic.js
// From http://www.brewsession.com/problematic-decimal-arithmetic-in-javascript/
String.prototype.digitsAfterDecimal = function()
{ var parts = this.split(".", 2); // FIXME: Not international!
if( ! parts[1] )
{ parts[1] = ""; }
return parts[1].length;
};