Skip to content

Instantly share code, notes, and snippets.

val result: Stream[Task, Prediction] = specimenStream.flatMap((spec: Document) =>{
modelStream.fold(List.empty[TopN]) { case (topNVec, mod) =>
val res = calcDistance(spec, mod)
val newTopN = TopN(res.modelElm.label.get, res.distance)
(topNVec :+ newTopN).sortBy(res => res.confidence).take(nearest)
}.map(topNVec => Prediction(spec.text, topNVec.toList) )
})
case class Yard(yardId: Id[Yard], clientId: Id[Client], yardName: String, deleted: Boolean) extends Location with ClientManaged
- name: Simple test for raw + environment.
hosts: localhost
connection: local
tasks:
- name: Issue a warning
raw: echo hello world
environment:
foo: bar
- name: Don't issue a warning
raw: whoami
val content = StreamConverters.asOutputStream().mapMaterializedValue { os =>
writeXlsDataToStream(os)
os.close()
}
Ok.chunked(content).as("application/xls").withHeaders(
"Mime-Type" -> "application/xls",
"Content-disposition" -> s"attachment; filename=Report${DateTimeFormat.forPattern("_ddMMMYYYY_HHmmss").print(new DateTime)}.xls"
)
import play.api.libs.json.Json
val j= """
|[
| {
| "_key": "A1",
| "name": "Foo and Bar",
| "contents": [
| {
| "Android Wear": [
| "Notifications",