Skip to content

Instantly share code, notes, and snippets.

View matthewmccullough's full-sized avatar

Matthew J. McCullough matthewmccullough

View GitHub Profile
@matthewmccullough
matthewmccullough / 0_reuse_code.js
Created December 5, 2013 02:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@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 / 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 / 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 / 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 = [ '/.+/' ]
}
}
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 / 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')
HOW TO ENABLE TETHERING ON YOUR 3.0 iPHONE
Step 1: Check if you own a 3G iPhone. If you're on EDGE (as I am): sorry. Tethering does not seem to work with EDGE phones.
Step 2: Check to see if AT&T is your carrier. If it is: sorry. AT&T will not let you tether.
Step 3: Navigate to ~/Library/iTunes/iPhone Carrier Support. Notice the spaces in that last folder name! If you're at the command line, use backslashes to escape the spaces, i.e. cd ~/Library/iTunes/iPhone\ Carrier\ Support. You will find a file with an ipcc extension. Copy that file: e.g. cp foo.ipcc foo.ipcc.original. This creates a backup for when you mess up.
Step 4: rename the ipcc extension to zip. For me that was ATT_US.ipcc renamed to ATT_US.zip. (Did I mention how I'm on a 1st Gen iPhone with AT&T?). Unzip it. This creates a new folder called Payload.
@matthewmccullough
matthewmccullough / .bashrc
Created January 26, 2009 03:48 — forked from henrik/.bashrc
Henrik's Git-Dirty 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)]/"
@matthewmccullough
matthewmccullough / gist:48058
Created January 16, 2009 18:55 — forked from halbtuerke/gist:31934
Windows (Cygwin) Show Git dirty status in your Unix bash 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\]"