Skip to content

Instantly share code, notes, and snippets.

@paulfryzel
paulfryzel / gist:1854375
Created February 17, 2012 17:02
Center ul within div
#foo {
text-align: center;
ul {
display: inline-block;
list-style: none;
margin: 0 auto
width: 100%;
}
@paulfryzel
paulfryzel / gist:1765396
Created February 8, 2012 04:15
JavaConversions confusion
scala> val m = Map(1 -> 2)
m: scala.collection.immutable.Map[Int,Int] = Map(1 -> 2)
scala> m.get("1")
<console>:9: error: type mismatch;
found : java.lang.String("1")
required: Int
m.get("1")
^
@paulfryzel
paulfryzel / gist:1725783
Created February 2, 2012 21:08
Using Maven Shade Plugin with Storm
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
@paulfryzel
paulfryzel / gist:1153293
Created August 18, 2011 04:27
Ensure IO is properly closed
def convert(command: String, fileIn: String, fileOut: String): Unit = {
val input = new FileInputStream(fileIn)
val output = new FileOutputStream(fileOut)
val converter = new MagickConverter("(no name)", command)
try {
converter.process(input, output)
} finally {
input.close()
output.close()
}