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.awt.{Color, Graphics2D} | |
import java.awt.image.BufferedImage | |
import javax.imageio.ImageIO | |
public class Main { | |
//Does not deal with double buffering, and writing on servers which are headless. | |
public BufferedImage createBlackImage(int width, int height) { | |
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); | |
Graphics2D graphics = (Graphics2D) image.getGraphics(); |
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
<project> | |
<parent> | |
<groupId>com.example</groupId> | |
<artifactId>parent</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
</parent> | |
<modelVersion>4.0.0</modelVersion> | |
<artifactId>rpm</artifactId> | |
<packaging>jar</packaging> | |
<name>Project :: RPM</name> |
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
diff --git a/spec/ems_spec.rb b/spec/ems_spec.rb | |
index 9620341..93732ed 100755 | |
--- a/spec/ems_spec.rb | |
+++ b/spec/ems_spec.rb | |
@@ -117,14 +117,14 @@ describe 'EMS' do | |
collection['href'].should eql collection_url | |
end | |
- %w(format body state audience slug title lang summary level).each do |field| | |
+ %w(format body state title lang summary level).each do |field| |
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
{ | |
"templates": [ | |
{ | |
"data": [ | |
{"name": "synth-id", "value": "urn:uuid:536c2060-c9ea-4781-97d9-12d6f717a88c"}, | |
{"name": "foo", "value": "bar"} | |
] | |
}, | |
{ | |
"data": [ |
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 net.hamnaberg.funclite.*; | |
public class Collect { | |
public static <A, B> Option<B> collect(A value, Predicate<A> p, Function<A, B> f) { | |
if (p.apply(value)) { | |
return Option.fromNullable(f.apply(value)); | |
} | |
return Option.none(); | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 unfilteredx.logging | |
import unfiltered.request._ | |
import unfiltered.response._ | |
import unfiltered.Cycle | |
import com.typesafe.scalalogging.Logger | |
import org.slf4j.LoggerFactory | |
object TraceLogging { | |
def apply[A, B](intent: Cycle.Intent[A, B])(implicit tl: TraceLogger[A, B]) = |
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 emsnav | |
import dispatch._, Defaults._ | |
import java.net.URI | |
import net.hamnaberg.json.collection._ | |
import concurrent.Await | |
import concurrent.duration._ | |
object Main extends App { | |
val MediaType = "application/vnd.collection+json" |
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 | |
jq "{template: .collection.template}" |
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
def string[T](req: HttpRequest[T])(implicit codec: Codec = Codec.UTF8) = { | |
loan(new InputStreamReader(req.inputStream, codec.charSet)) { reader => | |
val writer = new java.io.StringWriter | |
val ca = new Array[Char](4096) | |
@scala.annotation.tailrec def read() { | |
val len = reader.read(ca) | |
if (len > 0) writer.write(ca, 0, len) | |
if (len >= 0) read | |
} | |
read() |
OlderNewer