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
private[this] def picker[Question, Yes, No, Value]( | |
question: Question, onSuccess: Yes => Left[Value, Unit] | |
)( | |
implicit mYes: Manifest[Yes], mNo: Manifest[No] | |
): Future[Either[Value, Unit]] = { | |
// Promise for fallbacking that we're never going to fulfill. | |
val unfulfilledPromise = Promise() | |
val questions = actors.map { actor => actor ? question } |
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 helpers.action | |
import play.api._ | |
import http.HeaderNames | |
import libs.iteratee.Iteratee | |
import play.api.mvc._ | |
trait Logging extends ActionComposition { | |
override def Action[A](bodyParser: BodyParser[A])( |
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 helpers.action | |
import play.api.mvc._ | |
trait ActionComposition { | |
def Action[A](bodyParser: BodyParser[A])( | |
block: Request[A] => Result | |
): Action[A] = play.api.mvc.Action(bodyParser)(block) | |
def Action(block: Request[AnyContent] => Result): Action[AnyContent] = |
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
val system = ActorSystem.create( | |
"geoliser", ConfigFactory.load.getConfig("geoliser") | |
) | |
val router = system. | |
actorOf(Props[Worker].withRouter(FromConfig()), "router") |
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
private[this] lazy val system = ActorSystem( | |
"lobby", ConfigFactory.load.getConfig("application.lobby") | |
) | |
private[this] def actors = config.underlying. | |
getStringList("application.lobby.nodes").map { path => | |
logger.info("Trying to get actor for " + path) | |
logger.info("System %s, terminated: %s".format( | |
system.toString, system.isTerminated | |
)) | |
val actor = system.actorFor(path) |
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
$ cat aa.scala && javap -c Foo.class Bar.class | |
class Foo { val aa = 3 } | |
class Bar { def aa = 3 } | |
Compiled from "aa.scala" | |
public class Foo implements scala.ScalaObject { | |
public int aa(); | |
Code: | |
0: aload_0 | |
1: getfield #11 // Field aa:I |
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
val parser = new Parser { | |
var builder: GraphBuilder = _ | |
var agency: File = _ | |
var stops: File = _ | |
var routes: File = _ | |
var trips: File = _ | |
var stopTimes: File = _ | |
var calendar: File = _ | |
var calendarDates: Option[File] = _ | |
var frequencies: Option[File] = _ |
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
class Foo { def hi = "Hello from Foo!" } | |
class Bar extends Foo { override def hi = "Hello from Bar!" } | |
abstract class Consumer { | |
type R <: Foo // abstract type R that is Foo or extends Foo | |
def greet(foo: R) = foo.hi // method "greet" with 1 arg "foo" of type R, calls and returns foo.hi | |
} | |
class FooConsumer extends Consumer { | |
type R = Foo // Concretize type R to Foo. |
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 DegreeCoords(lat: Double, lon: Double) | |
implicit object NodeDegreeCoords extends Format[Node.DegreeCoords] { | |
def reads(json: JsValue) = Node.DegreeCoords( | |
(json \ "lat").as[Double], | |
(json \ "lng").as[Double] | |
) | |
def writes(o: Node.DegreeCoords) = | |
toJson(Map("lat" -> o.lat, "lng" -> o.lon)) |
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
arturas@zeus:~/work/traveltime-api/vendor/igeolise-lib$ javap -c Foo.class | |
Compiled from "test.scala" | |
public class Foo implements scala.ScalaObject { | |
public int x(); | |
Code: | |
0: aload_0 | |
1: getfield #11 // Field x:I | |
4: ireturn | |
public void x_$eq(int); |