Skip to content

Instantly share code, notes, and snippets.

View joostlawerman's full-sized avatar

Joost Lawerman joostlawerman

View GitHub Profile
#!/bin/bash
FILE=$1
MESSAGE=$(cat $FILE)
TICKET=$(git rev-parse --abbrev-ref HEAD | grep -Eo '^(\w+/)?(\w+[-_])?[0-9]+' | grep -Eo '(\w+[-])?[0-9]+' | tr "[:lower:]" "[:upper:]")
if [[ $TICKET == "[]" || "$MESSAGE" == "$TICKET"* ]];then
exit 0;
fi
echo "$TICKET: $MESSAGE" > $FILE

Keybase proof

I hereby claim:

  • I am joostlawerman on github.
  • I am joostjoh (https://keybase.io/joostjoh) on keybase.
  • I have a public key ASBd96qhmznkeJS1d8-0us6XM4uumVLhCiWPqn7VNTRM1go

To claim this, I am signing this object:

@joostlawerman
joostlawerman / SubscribableObserver.java
Last active December 13, 2016 17:29
Simple Java observer wrapper
import java.util.Observable;
public class SubscribableObserver<valueType> extends Observable {
protected valueType value;
public SubscribableObserver(valueType value) {
this.value = value;
}
@joostlawerman
joostlawerman / bashrc
Last active July 25, 2016 14:17
Bash git branch name
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^​*]/d' -e 's/*​ \(.*\)/ \1 /'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;35m\] $(parse_git_branch)\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w $(parse_git_branch)\$ '
fi