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
describe "planets|player_index" do | |
before(:each) do | |
@action = "planets|player_index" | |
@params = {} | |
end | |
it_behaves_like "only push" | |
it_should_behave_like "having controller action scope" | |
it "should return players planets" do |
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 badParams(msg: String) = BadRequest( | |
Json.toJson(Map("error" -> ("Be sure to have these params defined: "+msg))) | |
) | |
def create = Action(parse.json) { request => | |
(for ( | |
modeStr <- (request.body \ "mode").asOpt[String]; | |
mode <- Graph.ConnectionsMode.withNameOpt(modeStr); | |
time <- (request.body \ "travel_time").asOpt[Int]; | |
lat <- (request.body \ "origin" \ "lat").asOpt[Double]; |
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 sbt._ | |
import sbt.Keys._ | |
object PluginDef extends Build { | |
override lazy val projects = Seq(root) | |
lazy val igeoliseLib = RootProject(file("../../lib")) | |
lazy val root = Project( | |
"plugins", file("."), | |
settings = Defaults.defaultSettings ++ Seq( |
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
inputTask[Unit] { argTask => | |
(argTask, scalaVersion) map { case(args, sv) => Map.empty[String, String] } | |
} |
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 TimeFilterTest extends ProjectSpec { | |
lazy val time = 200 | |
lazy val mode = Graph.ConnectionsMode.Driving | |
lazy val origin = Node.DegreeCoords(1.4, 7.8) | |
lazy val threshold = 500000 | |
describe("instance") { | |
lazy val isochroneMock = mock[Isochrone] | |
lazy val instance = new TimeFilter( | |
time, mode, origin, threshold = threshold |
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
<configuration> | |
<conversionRule conversionWord="coloredLevel" | |
converterClass="play.api.Logger$ColoredLevel"/> | |
<appender name="FILE" class="ch.qos.logback.core.FileAppender"> | |
<file>${application.home}/logs/application.log</file> | |
<encoder> | |
<pattern>%date - [%level] - from %logger in %thread | |
%n%message%n%xException%n</pattern> | |
</encoder> |
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 ignored(prefix: String) = | |
log(prefix)("Ignored: " + prefix) ~ any(80 - prefix.length) | |
/** Header **/ | |
def header = ignored("HD") ~ nl | |
/** Ignored record types - these have no meaning for us **/ | |
def tiplocInsert = ignored("TI") ~ nl |
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
$ head -n 50 ../api/data/sources/atoc.mca | |
HDTPS.UCFCATE.PD1210050510122309DFTTISD FA051012180513 | |
TIAACHEN 00081601LAACHEN 00005 0 | |
TIABCWM 00385964VABERCWMBOI 78128 0 | |
TIABDAPEN00398202VPENYWAUN BUS 00000 0XPZ | |
TIABDARE 00398200TABERDARE 78100 0ABAABERDARE | |
TIABDATRE00398203ATRECYNON BUS 00000 0XTO | |
TIABDO 00909000ZABERDOUR 03295 0AURABERDOUR | |
TIABDVY 00443500EABERDOVEY 64409 0AVYABERDOVEY | |
TIABER 08381300LABER 78371 0ABEABER |
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
def parse(file: File): ListBuffer[Schedule] = { | |
val reader = new BufferedReader(new FileReader(file)) | |
try { | |
val schedules = ListBuffer.empty[Schedule] | |
var basicSchedule: BasicSchedule = null | |
var origin: OriginLocation = null | |
var intermediateLocations = ListBuffer.empty[IntermediateLocation] | |
var line: String = reader.readLine() |
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
intermediateLocations match { | |
case Nil => | |
f(oDeparture, tArrival) | |
case intermediate :: Nil => | |
f(oDeparture, iArrival(intermediate)) | |
f(iDeparture(intermediate), tArrival) | |
case _ => | |
f(oDeparture, iArrival(intermediateLocations.head)) | |
val last = intermediateLocations.sliding(2). | |
foldLeft(intermediateLocations.head) { |