Skip to content

Instantly share code, notes, and snippets.

@gourlaysama
gourlaysama / midi.scala
Last active August 15, 2016 16:54
Midi access in scala.js
import dom.raw.Navigator
@native
trait MidiNavigator extends Navigator {
def requestMIDIAccess(): MidiAccess = js.native
}
object MidiNavigator {
implicit def midinavigator(mn: Navigator): MidiNavigator =
@gourlaysama
gourlaysama / build.sbt
Created August 12, 2014 20:28
Using -Xmacro-settings from SBT
scalaVersion in ThisBuild := "2.11.2"
lazy val macros = project settings(
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
scalacOptions += "-language:experimental.macros")
lazy val main = project dependsOn(macros) settings(
scalacOptions += "-Xmacro-settings:foo=bar,bippy")
@gourlaysama
gourlaysama / Benchmark.scala
Created June 25, 2014 12:41
small benchmark for SI-7710 / SI-8542 in scala-parser-combinators
package test
import scala.util.parsing.combinator.RegexParsers
import java.io.StringReader
object SI8542_ParserCombinatorBenchmark extends App with RegexParsers {
lazy val line = """(?m)^.*$""".r ^^ { _ => 0 }
lazy val parser = rep(line) ^^ { _ => 1 }
@gourlaysama
gourlaysama / JVM.md
Last active December 21, 2015 10:39
a collection of resources about the JVM, its internals and other things...
@gourlaysama
gourlaysama / output
Last active December 20, 2015 06:58
Breaking scalac with a wrong jar results in weird error message...
error: error while loading <root>, error in opening zip file
error: scala.reflect.internal.MissingRequirementError: object scala.runtime in compiler mirror not found.
at scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:16)
at scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:17)
at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:48)
at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:40)
at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:61)
at scala.reflect.internal.Mirrors$RootsBase.getPackage(Mirrors.scala:172)
at scala.reflect.internal.Mirrors$RootsBase.getRequiredPackage(Mirrors.scala:175)
at scala.reflect.internal.Definitions$DefinitionsClass.RuntimePackage$lzycompute(Definitions.scala:181)
import org.orbisgis.utils.FileUtils;
public class WMSTest {
...
private File f;
@Before
public void setUp() throws Exception {
f = File.createTempFile("wms", null);
f.delete();