Skip to content

Instantly share code, notes, and snippets.

View janhicken's full-sized avatar

Jan Hicken janhicken

  • Reeeliance IM GmbH
  • Hamburg, Germany
View GitHub Profile
@janhicken
janhicken / CloudFunctions.scala
Last active March 27, 2020 15:45
Google Cloud Functions with Scala.js
package de.janhicken.cfwithscala
import scala.scalajs.js.annotation.JSExportTopLevel
object CloudFunctions {
@JSExportTopLevel("helloWorld")
val helloWorld: CloudFunction = (request, response) ⇒ {
response.status(200).send("Hello World!")
}
}
@janhicken
janhicken / Producer.scala
Last active November 25, 2017 16:07
Extract EMF Resource (type-)safely with Scala pattern matching
import java.io.IOException
import org.eclipse.emf.ecore.EObject
import org.eclipse.emf.ecore.resource.Resource
import scala.collection.JavaConverters._
import scala.reflect.ClassTag
class TypesafeResourceExtractor[T <: EObject : ClassTag] {
def extractResource(resource: Resource): T = {