Skip to content

Instantly share code, notes, and snippets.

View stigkj's full-sized avatar

Stig Kleppe-Jørgensen stigkj

View GitHub Profile
@stigkj
stigkj / mergefrom.rb
Created March 3, 2010 15:34 — forked from andre/mergefrom.rb
A dirt-simple script to merge a pull request from someone on github
#! /usr/bin/env ruby
require "open3" # for reading stderr
# A dirt-simple script to merge a pull request from someone on github.
# Andre Lewis, 2009
#
# Assumptions:
# 1. you're currently working on master
# 2. you've already reviewed the pull request and have decided to include it.
public static void setSwingFontDefault(javax.swing.plaf.FontUIResource newFont) {
java.util.Enumeration<Object> uiManagerKeys = UIManager.getDefaults().keys();
while (uiManagerKeys.hasMoreElements()) {
Object key = uiManagerKeys.nextElement();
Object value = UIManager.get(key);
if (value instanceof javax.swing.plaf.FontUIResource)
UIManager.put(key, newFont);
}
}
@stigkj
stigkj / .bashrc
Created April 14, 2010 15:22 — forked from matthewmccullough/.bashrc
Show git branch/'dirtyness' in prompt
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
@stigkj
stigkj / Look for JARs containing...
Created April 14, 2010 15:23 — forked from matthewmccullough/findjars.bsh
Find class in all jars recursively
#!/bin/sh
#Example Usage: findjars com/ambientideas/groovy
CLASSNAMETOFIND="$1"
echo "Searching all JARs recursively..."
for eachjar in `find . -iname "*.jar"`
do
#echo "Searching in $eachjar ..."
@stigkj
stigkj / gist:365923
Created April 14, 2010 15:24 — forked from matthewmccullough/gist:47267
Another git dirty status in prompt
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
@stigkj
stigkj / gist:365929
Created April 14, 2010 15:27 — forked from augustjoki/gist:31867
Improved parse git branch version for the git prompt
function parse_git_branch {
[ -d .git ] || return 1
git_status="$(git status 2> /dev/null)"
branch_pattern="^# On branch ([^${IFS}]*)"
remote_pattern="# Your branch is (.*) of"
diverge_pattern="# Your branch and (.*) have diverged"
if [[ ! ${git_status}} =~ "working directory clean" ]]; then
state="*"
fi
# add an else if or two here if you want to get more specific
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.3.RELEASE</version>
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'dependency'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.mycompany.app:my-app:jar:1
[INFO] task-segment: [dependency:tree]
[INFO] ------------------------------------------------------------------------
Downloading: http://download.java.net/maven/2/org/springframework/spring-context/3.0.3.RELEASE/spring-context-3.0.3.RELEASE.pom
[INFO] Unable to find resource 'org.springframework:spring-context:pom:3.0.3.RELEASE' in repository java-net (http://download.java.net/maven/2)
Downloading: http://repo1.maven.org/maven2/org/springframework/spring-context/3.0.3.RELEASE/spring-context-3.0.3.RELEASE.pom
Apache Maven 3.0-beta-1 (r935667; 2010-04-19 19:00:39+0200)
Java version: 1.6.0_20
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.6.3" arch: "x86_64" Family: "mac"
# Ignore all IntelliJ IDEA project files
.idea/
*.iml
*.ipr
*.iws
# Ignore Maven target directories
target/
# Ignore all log files