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 sensorDatas = TableQuery[SensorDataTable] | |
val sensorRoomLinks = TableQuery[SensorRoomLinks] | |
private def sensorsForRoomsForRange(roomLinks: Seq[SensorRoomLink], from: ZonedDateTime, to: ZonedDateTime): Query[(tables.SensorRoomLinks, tables.SensorDataTable), (SensorRoomLink, UtilizationData), Seq] = { | |
import IdTable._ | |
val joined = sensorDatas join sensorRoomLinks on (_.sensorId === _.sensorUid) | |
val filtered = joined.filter { case (data, link) => (link.roomId inSet roomLinks) && (data.sensorUid inSet sensorIds) && /* other conditions here */ } | |
val grouped = filtered.groupBy { case (data, link) => link.roomId } | |
val aggregated = grouped.map { case (roomId, rows) => roomId -> rows.map{ case (data, link) => data.value }.max } | |
aggregated |
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
trait VectorSpace[A] { } // isomorphisms | |
trait Iso[A, B] { | |
def to(a: A): B | |
def from(b: B): A | |
} | |
trait TensorAlgebra { | |
type * [V] | |
type ⨂ [V, W] | |
type ⨁ [V, W] | |
type Z |
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 scalaz.stream.{Process, Tee, tee} | |
import Process.{awaitL, awaitR, emit} | |
import tee.{feed1R, feed1L} | |
object StreamSupport { | |
/* A Tee that drop from left while the predicate `p` is true for the | |
* values, then continue with the Tee `rest` */ | |
def dropWhileL[L,R,O](p: L => Boolean)(rest: Tee[L,R,O]): Tee[L,R,O] = | |
awaitL[L].flatMap { v => |
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
(add-hook 'js-mode-hook '(lambda () | |
;; /home/hvesalai/projects/foo/Bar.jsx: line 6, col 63 | |
(add-to-list 'compilation-error-regexp-alist-alist | |
`(eslint-compact | |
,(rx line-start | |
(group (zero-or-one letter ":") (1+ (not (any ": ")))) | |
": line " (group (1+ digit)) | |
", col " (group (1+ digit))) | |
1 2 3)) |
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 (o1: Option[B], o2: Option[C]): A = { | |
val a: A = new A | |
val b: A = o1.map(o => A.foo(o)).getOrElse(a) | |
o2.map(o => A.bar(o)).getOrElse(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 Main { | |
def main(args: Array[String]) { | |
MySquerylScheme.initialize() | |
WebServer("src/main/webapp", Config.webServerPort) { server => | |
server.inContext("/api") { context => | |
context.mount("validate", new ValidateApp) | |
context.mount("channels", new MessageChannelApp) | |
context.mount("streams", new StreamsApp) |
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 Main { | |
def main(args: Array[String]) { | |
MySquerylScheme.initialize() | |
WebServer("src/main/webapp", Config.webServerPort) { server => | |
server.inContext("/api") { context => | |
context.mount("validate", new ValidateApp) | |
context.mount("channels", new MessageChannelApp) | |
context.mount("streams", new StreamsApp) |