yell() { echo "$0: $*" >&2; }
die() { yell "$*"; exit 111; }
try() { "$@" || die "cannot $*"; }
scriptdir() { (cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd) }
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static <T> T deepCopyJAXB(T object, Class<T> clazz) { | |
try { | |
JAXBContext jaxbContext = JAXBContext.newInstance(clazz); | |
JAXBElement<T> contentObject = new JAXBElement<T>(new QName(clazz.getSimpleName()), clazz, object); | |
JAXBSource source = new JAXBSource(jaxbContext, contentObject); | |
return jaxbContext.createUnmarshaller().unmarshal(source, clazz).getValue(); | |
} catch (JAXBException e) { | |
throw new RuntimeException(e); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package scripts.rest | |
def values = [:] | |
params.each { name, value -> values[name] = value } | |
headers.each { name, value -> values[name] = value } | |
cookies.each { name, value -> values[name] = value } | |
sessionAttributes.each { name, value -> values[name] = value } | |
return values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
num_fragments = 0 | |
counter = lambda { num_fragments += 1 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Author: Darren Day | |
*/ | |
function handleResponse(data) { | |
var source = $("#template").html(); | |
var template = Handlebars.compile(source); | |
var result = template({ | |
"links": data | |
}); | |
$("#main").append(result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Field; | |
/** | |
* Utility method for quickly building mock models | |
*/ | |
public class Builder { | |
public static <T> T build(Class<T> clazz, Object... keyValues) { | |
try { | |
return build(clazz, clazz.newInstance(), keyValues); | |
} catch (InstantiationException e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<templateSet group="user"> | |
<template name="with" value="public $FooBuilder$ with$Foo$($FooType$ $foo$) { this.$foo$ = $foo$; return this; }" description="generate a builder with param setter" toReformat="true" toShortenFQNames="true"> | |
<variable name="foo" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="FooBuilder" expression="className()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="FooType" expression="typeOfVariable(foo)" defaultValue="" alwaysStopAt="false" /> | |
<variable name="Foo" expression="capitalize(foo)" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_CODE" value="true" /> | |
<option name="JAVA_COMMENT" value="false" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.xml.bind.*; | |
import javax.xml.bind.util.JAXBSource; | |
import javax.xml.namespace.QName; | |
import javax.xml.transform.stream.StreamSource; | |
public class DeepCopier<T> { | |
private static QName qname = new QName("deepcopy"); | |
private Unmarshaller unmarshaller; | |
private JAXBElement<T> contentObject; | |
private Marshaller marshaller; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# just some hackity hack to manage the remote tomcat on old-darrend-desktop | |
class TomcatOldEnvironment | |
def initialize targetslot | |
@targetslot = targetslot | |
end | |
def targetslot |
NewerOlder