Skip to content

Instantly share code, notes, and snippets.

View jesperronn's full-sized avatar

Jesper Rønn-Jensen jesperronn

View GitHub Profile
@jesperronn
jesperronn / git filter-branch
Created January 21, 2015 14:33
git filter-branch author EMAIL
NEW_MAIL="jesp....@gmail.com"
git filter-branch --env-filter '
> if [[ "$GIT_AUTHOR_EMAIL" = "EMAIL" || "$GIT_AUTHOR_EMAIL" = "$NEW_MAIL" ]]
> then
> if [[ "$GIT_AUTHOR_NAME" = "Ben Alman" ]]
> then
> GIT_AUTHOR_NAME="Jesper Rønn-Jensen"
> GIT_COMMITTER_NAME="Jesper Rønn-Jensen"
> export GIT_AUTHOR_NAME
> export GIT_COMMITTER_NAME
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to make opened Markdown files always be soft wrapped:
#
# path = require 'path'
#
@jesperronn
jesperronn / color_prompt.sh
Last active August 29, 2015 14:08
Color command prompt (git aware)
export PS1='$(tput dim)\t $(tput setaf 5)[\w]$(tput setaf 2)$(__git_ps1 "(%s)")$(tput sgr0)\$ '
@jesperronn
jesperronn / git-grafts-example
Created May 22, 2014 11:10
git grafts example
# grafts define parents for commits see https://git.wiki.kernel.org/index.php/GraftPoint
#
# save this file as .git/info/grafts
#
#
# format:
# <commit sha1> <parent sha1> [<parent sha1>]*
#
# each entry terminated by a newline
#
@jesperronn
jesperronn / gist:9344831
Last active August 29, 2015 13:56
IntelliJ Jasmine tab triggers. Here are my definitions so that you can type ”it” and “desc” in your javascript test file.
Abbreviation: desc
Description: jasmine describe()
Applicable in: Javascript
Expand with: Default (Tab)
Template text:
describe('$SYSTEM_UNDER_TEST$', function() {
beforeEach(function() {
//First top level needs configure:
//jasmine.configure()
@jesperronn
jesperronn / duplication.sh
Created January 21, 2014 10:32
Duplicate java class finder Finds java classes with same name and counts occurrences
# Find all java classes in tree. (including auto-generated classes in 'target' folders:
find . -name "*.java" | xargs egrep -o "class [A-Z]\w+" | awk '{print $2}' | sort | uniq -c | sort -n | grep -v 1
# Use git (faster).
#Ignores any auto-generated classes since they are typically inside ignored 'target' folders
git grep --extended-regexp --no-index "class [A-Z]\w+" | egrep -o "class [A-Z]\w+" | awk '{print $2}' | sort | uniq -c | sort -n | grep -v 1
@jesperronn
jesperronn / releasenotes
Last active November 17, 2022 06:07
releasenotes script (with git)
#!/usr/bin/ruby
#
# release notes script
# takes two git tags and prints any changes between them
#
# usage:
# ./releasenotes.sh [from] [to] [releasename]
#
# with [from] and [to] being git tags
@jesperronn
jesperronn / WebService.java
Created September 13, 2013 11:12
EJB annotations and their probable replacement
@Webservice(name="", serviceName="")
package javax.jws;
public @interface WebService {}
maven pom:
<dependency>
@jesperronn
jesperronn / GenericCollection.java
Last active December 14, 2015 08:18
Java Generic collection objects, where you can dot them
package com.my.collections;
import java.io.Serializable;
import java.util.*;
/**
* <p/>
* Superclass for handling a collection of objects. He super class contains
@jesperronn
jesperronn / isDefined.sh
Created February 26, 2013 19:11
isDefined() unix method to determined if a variable exists
function isDefined() {
varname=$1;
declare -p $varname >/dev/null 2>&1;
if [ "$?" -eq 0 ]; then
echo Defined;
fi;
}
http://nixcraft.com/shell-scripting/15375-testing-bash-variable-existence.html