This file contains hidden or 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 spark | |
| import spark.util.AkkaUtils | |
| object SparkAkka { | |
| private[this] lazy val config = be.bigdata.p2.conf.root.getConfig("deploy.akka") | |
| lazy val name = config.getString("name") | |
| lazy val host = config.getString("host") | |
| lazy val port = config.getInt("port") | |
| lazy val actorSystem = AkkaUtils.createActorSystem(name, host, port)._1 |
This file contains hidden or 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
| object conway { | |
| def neighbours(p:(Int, Int)) = | |
| for { | |
| dx <- List(-1, 0, 1) | |
| dy <- if (dx == 0) List(-1, 1) else List(-1, 0, 1) | |
| } yield (dx+p._1, dy+p._2) | |
| def step(cells:List[(Int, Int)]) = | |
| cells |
This file contains hidden or 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 cocontra | |
| import model._ | |
| object Co extends App { | |
| val kids = List(new Kid(9)) | |
| val humans:List[Human] = kids | |
| println(humans) |
This file contains hidden or 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
| /* | |
| First implementation of a Matrix String Interpolator. | |
| This is a manipulable matrix strucutre | |
| mat""" | |
| | 1 | 2 | |
| | 3 | | |
| """ | |
| */ | |
| object Mat { |
This file contains hidden or 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
| * create a Neo4j Rest API on WebShell | |
| * create a macro that will check cypher queries | |
| * import TopoJSON in Neo4J, probably using org.neo4j.gis.spatial.pipes.GeoPipeFlow like org.neo4j.gis.spatial.pipes.processing.GeoJSON does |
This file contains hidden or 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 play.api.libs.json._ | |
| //this is crap but ease a lot the switch to play 2.1 | |
| implicit def smashThat[A](js:JsResult[A]):A = js.recoverTotal { err => throw new RuntimeException(Json.stringify(JsError.toFlatJson(err))) } | |
| val j = Json.obj("a"->1, "b"->2) | |
| val m:Map[String, Int] = Json.fromJson[Map[String, Int]](j) |
This file contains hidden or 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 test | |
| object Template { | |
| case object A { | |
| def apply(i:Int) = "A " + i | |
| } | |
| case object B { | |
| def apply() = "B" |
This file contains hidden or 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
| object Covariant extends App { | |
| trait Vehicle { | |
| def name:String | |
| def velocity:Float | |
| } | |
| case class Car(name:String, velocity:Float) extends Vehicle | |
| object VehiculeStats { | |
| def meanVelocity(vs:List[Vehicle]):Float = |
This file contains hidden or 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 tc | |
| object Main extends App { | |
| import tc.Action._ | |
| import tc.Generator._ | |
| import tc.User._ | |
| // a user | |
| val user = User(None, "noootsab", true, 31) | |
| println(s"User $user") |
This file contains hidden or 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
| case class Banque(nom:String) {banque => | |
| def accepte(m:Montant) = | |
| CompteBuilder(banque, m) | |
| } | |
| implicit def stringToBanque(s:String) = Banque(s) | |
| implicit def intWithDevise(i:Int) = new { |