Skip to content

Instantly share code, notes, and snippets.

Ralph Jennings rage-shadowman

Block or report user

Report or block rage-shadowman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rage-shadowman
rage-shadowman / pre-push.sh
Last active May 6, 2019 — forked from fwielstra/pre-push
A pre-push git hook which runs a gradle test task
View pre-push.sh
#!/bin/sh -e
#
# to install this hook, create a symbolic link in the projects .git/hooks folder
#
# i.e. - from the .git/hooks directory, run
# $ ln -s /location/of/git-hooks/pre-push.sh pre-push
#
# to skip the tests, run with the --no-verify argument
# i.e. - $ 'git push --no-verify'
@rage-shadowman
rage-shadowman / ChainableFuture.java
Last active Feb 24, 2017
An attempt at a safe CompletionStage/Future class. You will need to use CompletableFuture in your own code and complete it (either successfully or exceptionally) as you normally would, but then you can wrap it in a SafePromise to return something less dangerous to your callers.
View ChainableFuture.java
package com.rage.shadowman.promise;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.BiConsumer;
@rage-shadowman
rage-shadowman / MomentJsDateFormatHelper.java
Last active Aug 29, 2015
MomentJsDateFormatHelper that I use with jknack's handlebars.java project.
View MomentJsDateFormatHelper.java
import com.github.jknack.handlebars.Helper;
import com.github.jknack.handlebars.Options;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.io.IOException;
import java.io.InputStream;
@rage-shadowman
rage-shadowman / git-backup-svn-based-repo.sh
Last active Dec 22, 2015
Create a backup git repo for a git-svn clone. To restore from such a backup, see: https://gist.github.com/rage-shadowman/6471961
View git-backup-svn-based-repo.sh
#!/bin/sh
if [ "$#" -ne 1 ]
then
echo 'Usage: $0 <existing-bare-git-repo>'
exit 1
fi
if ! git ls-remote "$1" > /dev/null 2>&1
then
@rage-shadowman
rage-shadowman / git-clone-svn-based-repo.sh
Last active Dec 22, 2015
Script to clone a git-svn backup repo. To create the backup repo, see: https://gist.github.com/rage-shadowman/6472005
View git-clone-svn-based-repo.sh
#!/bin/sh
#
# git-clone-svn-based-repo.sh:
#
# clones a git-svn based repo including all SVN commits without pounding
# the SVN server for hours (just a quick refresh taking seconds)
#
usage_exit ()
{
@rage-shadowman
rage-shadowman / pre-receive
Last active Jan 12, 2016
This is a git pre-receive hook for backups of git-svn clones to keep from pushing anything to the backup repository that doesn't have a git-svn-id (reject anything that did not get dcommitted first). Recommended for backups created using: https://gist.github.com/rage-shadowman/6472005
View pre-receive
#!/bin/sh
. git-sh-setup
read oldValue newValue refName
if ! git log -1 $newValue | grep -q '^ git-svn-id: '
then
echo "Must not commit to Git unless already dcommitted to SVN!"
exit 1
fi
@rage-shadowman
rage-shadowman / git-svn-diff.sh
Last active Aug 28, 2017 — forked from markjaquith/git-svn-diff.sh
fixed bug with diff of newly added files
View git-svn-diff.sh
#!/bin/bash
#
# git-svn-diff originally by (http://mojodna.net/2009/02/24/my-work-git-workflow.html)
# modified by mike@mikepearce.net
# modified by aconway@[redacted] - handle diffs that introduce new files
# modified by t.broyer@ltgt.net - fixes diffs that introduce new files
# modified by m@rkj.me - fix sed syntax issue in OS X
# modified by rage-shadowman - cleaned up finding of SVN info and handling of path parameters
# modified by tianyapiaozi - cleaned up some diff context lines
#
@rage-shadowman
rage-shadowman / jQuery-based-marquee.js
Last active Dec 15, 2015 — forked from remy/gist:2484402
Updated jQuery marquee plugin by Remy Sharp to handle window resize events. This has been tested only on horizontal right-to-left scrolling text. Theoretically it should work for vertical scrolling and left-to-right, but I have no use for that so I have not tested that behavior.
View jQuery-based-marquee.js
/**
* author Remy Sharp
* url http://remysharp.com/tag/marquee
*
* Ralph Jennings. 4/5/2013.
* Added support for "resize" event. If triggered, marquee is resized according to
* its parent's width and scroll position is updated accordingly.
*/
(function ($) {
You can’t perform that action at this time.