Skip to content

Instantly share code, notes, and snippets.

View matthewmccullough's full-sized avatar

Matthew J. McCullough matthewmccullough

View GitHub Profile
@matthewmccullough
matthewmccullough / JSE 6 API bookmarklet
Created April 2, 2009 13:53 — forked from loganj/JSE 6 API bookmarklet
Bookmarklet for Java SE 6 JavaDoc Search
same as http://pastie.org/434851 but with "I'm Feeling Lucky" so you skip the search results list.
javascript:void(q=prompt('Java%20class%20Name:',''));if(q)void(location.href='http://www.google.com/search?q='+escape(q)+'%20site%3Ajava.sun.com%2Fjavase%2F6%2Fdocs'+'&btnI=745')
import java.util.Map;
import static com.sun.btrace.BTraceUtils.*;
import com.sun.btrace.annotations.*;
@BTrace
public class ManyMethodTimerTemplate {
@TLS private static Map<String, Long> startTimes = newHashMap();
<% targetClasses.eachWithIndex { className, classData, classIndex -> %>
<% classData.targetMethods.eachWithIndex { targetMethod, methodIndex -> %>
@matthewmccullough
matthewmccullough / gist:142636
Created July 8, 2009 06:46 — forked from rhyolight/gist:142053
A btrace script for watching all groovy methods
btrace {
templates {
// all methods within mydomain classes
methodTimerTemplate {
template = 'btrace-templates\\ManyMethodTimerTemplate.template'
targetClasses {
'/com\\\\.mydomain\\\\..+/' {
targetMethods = [ '/.+/' ]
}
}
@matthewmccullough
matthewmccullough / pickjdk.sh
Created July 15, 2009 15:36 — forked from headius/pickjdk.sh
Choose a JDK on Mac
#!/bin/bash
#
# Provides a function that allows you to choose a JDK. Just set the environment
# variable JDKS_ROOT to the directory containing multiple versions of the JDK
# and the function will prompt you to select one. JAVA_HOME and PATH will be cleaned
# up and set appropriately.
# Usage:
# Include in .profile or .bashrc or source at login to get 'pickjdk' command.
# 'pickjdk' alone to bring up a menu of installed JDKs on OS X. Select one.
@matthewmccullough
matthewmccullough / pom.clj
Created December 7, 2009 17:41 — forked from talios/pom.clj
Add dependency with Clojure to Maven programatically
; Define the project and store in a variable
(def project (defproject "a:b:c"
:dependencies ["org.clojure:clojure:1.1.0-alpha-SNAPSHOT"
"org.clojure:clojure-contrib:1.0-SNAPSHOT"]))
; Use the provided API to easily add a new dependency programatically
(add-dependency! project "org.testng:testng:5.10")
; Return the project
project
@matthewmccullough
matthewmccullough / gist:302357
Created February 12, 2010 06:18 — forked from mkristian/gist:299995
Using the Shitty Maven plugin
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>shitty</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
@matthewmccullough
matthewmccullough / markdownhere.sh
Created November 27, 2010 16:27
Convert a markdown file to an HTML file and give the same name but with HTML as the file extension.
#!/bin/bash
#Uses the brew or macports binaries of 'markdown'. Needs the 'markdown' executable on the $PATH.
INPUTFILE="$1"
OUTPUTFILE=`echo "$INPUTFILE" | sed "s/\.md/\.html/"`
echo Writing markdown file to \"$OUTPUTFILE\"
markdown.pl "$INPUTFILE" > "$OUTPUTFILE"
@matthewmccullough
matthewmccullough / gitignorechanges.sh
Created January 24, 2011 04:08
This script sets up aliases for ignoring changes to a version controlled file
# Using Git? Want to ignore changes to a noisy (e.g. tool-updated file), yet have to have it exist to satisfy said tool?
# Check it in once to source code control, then ignore all future changes. This option only applies to your local clone.
# Use this by typing 'git ignorechanges MYFILE'
git config --global alias.ignorechanges = update-index --assume-unchanged
# Use this by typing 'git noticechanges MYFILE'
git config --global alias.noticechanges = update-index --no-assume-unchanged
@matthewmccullough
matthewmccullough / ignorerecursive.sh
Created January 24, 2011 16:06
Recursively ignore a target directory in Git
git init testrecursiveignore
cd testrecursiveignore
mkdir target
echo buildjunk > target/build1.log
mkdir -p subproject/target
echo buildjunk > subproject/target/build2.log
echo //HelloWorld >> code/mycode.java
@matthewmccullough
matthewmccullough / Rakefile
Created February 1, 2011 19:11
Rake build file that should create an output directory
require 'rake'
HOME = "#{File.dirname(__FILE__)}"
DEST = "#{HOME}/output"
task :default => [:genoutputfolders]
task :genoutputfolders do
directory "output"
directory "#{DEST}"