Skip to content

Instantly share code, notes, and snippets.

View matthewmccullough's full-sized avatar

Matthew J. McCullough matthewmccullough

View GitHub Profile
@matthewmccullough
matthewmccullough / JavaDocSearchBookmarklet.js
Created April 2, 2009 13:45
JavaDoc Search Bookmarklet
// JavaDoc Search Bookmarklet by Josh Goebel
// Original source at Pastie.net: http://pastie.org/434851
//
// Select the text below, then drag it to your browser's toolbar. This creates a
// bookmark to perform Java 6 searches. After you create the bookmark, you probably
// want to edit the description. On FireFox, just right click the bookmark, select
// Properties, and change the name.
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')
@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')
@matthewmccullough
matthewmccullough / settings.xml
Created April 13, 2009 19:41
Maven settings.xml Mirror Setup for Nexus
<mirrors>
<mirror>
<!--This is used to direct the public snapshots repo in the profile below over to a different nexus group -->
<id>nexus-public-snapshots</id>
<mirrorOf>public-snapshots</mirrorOf>
<url>http://localhost:8081/nexus/content/groups/public-snapshots</url>
</mirror>
<mirror>
<!--This sends everything else to /public -->
<id>nexus-public-releases</id>
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 / terminal.scpt
Created January 5, 2010 00:30
AppleScript to open a Terminal tab at the specified path
-----------------------------------------------------------------------
-- A Script that opens a specified command line folder name in a new
-- terminal tab.
--
-- Composed by Matthew McCullough, 2010
-- MIT License. Share freely.
-----------------------------------------------------------------------
--Reference for tab opening
-- http://lambie.org/2007/11/03/tabs-in-terminal-using-applescript-on-leopard/
--Reference for other scripting approaches with Terminal
tell application "Finder"
activate
set these_items to the selection
log these_items
repeat with this_item in these_items
set item_name to (get displayed name of this_item)
if item_name is not ".DS_Store" then
set current_com to (get comment of this_item)
if current_com is not "" then
set comment of this_item to current_com as string
@matthewmccullough
matthewmccullough / spotlight-flag-comments.scpt
Created January 25, 2010 16:26
Reapply spotlight comments to files
--Source: http://www.macosxhints.com/dlfiles/spotlight_comment_script.txt
-- you can change the text within quotes to suit your purposes....
property flag : "MySpotlightComment"
property delim : " - "
on adding folder items to this_folder after receiving these_items
tell application "Finder"
set folder_name to name of this_folder
repeat with this_item in these_items
set item_name to (get displayed name of this_item)