Skip to content

Instantly share code, notes, and snippets.

@freekh
freekh / sbt.scala
Created February 27, 2012 21:56
Library dependencies
libraryDependencies ++= Seq(
"org.specs2" %% "specs2" % "1.8.2" % "test",
"junit" % "junit" % "4.7" % "test"
)
@freekh
freekh / eclipse.scala
Created February 27, 2012 21:57
JUnitRunner for Eclipse
import org.junit.runner.RunWith
import org.specs2.mutable.Specification
import org.specs2.runner.JUnitRunner
@RunWith(classOf[JUnitRunner])
@freekh
freekh / either.scala
Created June 28, 2012 16:36
for comprehension error handling
val aOpt: Option[Int] = Some(1)
val c = for {
a <- aOpt.toRight("Missing something in first level!").right
b <- Option(2).toRight("Another failure!").right
} yield {
a + b
}
import sbt._
import Keys._
import play.Project._
object ApplicationBuild extends Build {
val appName = "javatest"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
import sbt._
import Keys._
import play.Project._
object ApplicationBuild extends Build {
val appName = "javatest"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
import sbt._
import Keys._
object VersionInfoPlugin extends Plugin {
val versionInfoPackage = SettingKey[String]("version-info-package")
val versionInfoClassTask = TaskKey[Seq[java.io.File]]("version-info-class", "writes a java class VersionInfo with information about the versionInfo to sourceManaged")
val versionInfo = TaskKey[String]("version-info", "the current versionInfo")
private val Classname = "VersionInfo"
@freekh
freekh / Build.scala
Created August 2, 2013 21:02
Replace the TODO with the path to the adept project and put this in the project/project/Build.scala file and it will load adept as a plugin
import sbt._
import sbt.Keys._
/** needed only till adept is released */
object PlayPlugins extends Build {
val adeptProjectPath = "TODO"
lazy val adeptSbt = ProjectRef(file(), "adept-sbt") //TODO: remove this file
lazy val root = Project(id = "play-adept-project",
base = file("."),
@freekh
freekh / constraint-galore
Created September 11, 2013 18:04
adept test cases
val A10s210 = {
Variant("A",
attributes = Set(
Attribute("version", Set("1.0")),
Attribute("scala-binary-version", Set("2.10"))),
artifacts = Set(
Artifact("a10s210", Set(Configuration("compile")))),
configurations = Map(
Configuration("compile") -> Set(
@freekh
freekh / gist:6549741
Created September 13, 2013 11:57 — forked from phaller/gist:6549614
Akka Team Blog:
http://letitcrash.com/
Shutdown Patterns in Akka 2:
http://letitcrash.com/post/30165507578/shutdown-patterns-in-akka-2
An Akka 2 Terminator:
http://letitcrash.com/post/29773618510/an-akka-2-terminator
@freekh
freekh / Emscripten.scala
Last active December 30, 2015 03:19
Emscripten 001
import sbt._
import sbt.Keys._
import play.Keys._
import play.PlayExceptions._
import play.PlaySourceGenerators
object EmscriptenKeys {
val eccFiles = taskKey[PathFinder]("C/C++ files to be compiled")
val eccCompiler = settingKey[String]("Path to Emscripten compiler")
}