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
#!/bin/bash | |
# | |
# Cleans up docker files: | |
# - Deletes untagged docker images | |
# - Deletes stopped docker containers | |
# - Deletes long-running docker containers (use with care!) | |
set -e | |
if [ $# -eq 0 ]; then |
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
# | |
# This config file is a combination of ideas from: | |
# http://www.37signals.com/svn/posts/1073-nuts-bolts-haproxy | |
# http://www.igvita.com/2008/05/13/load-balancing-qos-with-haproxy/ | |
# http://wiki.railsmachine.com/HAProxy | |
# http://elwoodicious.com/2008/07/15/nginx-haproxy-thin-fastcgi-php5-load-balanced-rails-with-php-support/ | |
# http://upstream-berlin.com/2008/01/09/using-haproxy-with-multiple-backends-aka-content-switching/ | |
# http://wiki.railsmachine.com/HAProxy | |
# http://gist.github.com/raw/25482/d39fb332edf977602c183194a1cf5e9a0b5264f9 | |
# |
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 class XmlIndent { | |
/* | |
* Format XML with indentation | |
*/ | |
private static String prettyFormat(InputStream input, int indent) { | |
try { | |
Source xmlInput = new StreamSource(input); | |
StringWriter stringWriter = new StringWriter(); | |
StreamResult xmlOutput = new StreamResult(stringWriter); | |
TransformerFactory transformerFactory = TransformerFactory.newInstance(); |
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.util.Map; | |
import com.google.common.collect.Maps; | |
/* | |
* An example enumeration using a hash map to lookup an enumeration instance per ID. | |
* | |
* A lookup in a hash map is way faster than iterating for the enum instances until you | |
* find the matching one. | |
* |
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 final class DomUtil { | |
private DomUtil() { | |
// prevent instantiation | |
} | |
public static Document stringToDocument(String xml) throws Exception { | |
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); | |
factory.setNamespaceAware(true); | |
InputSource input = new InputSource(new StringReader(xml)); |
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" standalone="no"?><templates><template autoinsert="true" context="java-members" deleted="false" description="tear down after test" enabled="true" name="after">@${afterType:newType(org.junit.After)} | |
public void tearDown() throws Exception { | |
${cursor} | |
}</template></templates> |
NewerOlder