This file contains 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.Json | |
val j= """ | |
|[ | |
| { | |
| "_key": "A1", | |
| "name": "Foo and Bar", | |
| "contents": [ | |
| { | |
| "Android Wear": [ | |
| "Notifications", |
This file contains 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 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" | |
) |
This file contains 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
- 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 |
This file contains 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 Yard(yardId: Id[Yard], clientId: Id[Client], yardName: String, deleted: Boolean) extends Location with ClientManaged |
This file contains 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 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) ) | |
}) |
This file contains 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 Book(title: String, category: String, rating: Int) | |
val t = List( | |
Book("The dark", "Mystery", 90), | |
Book("What is", "Romance", 55), | |
Book("This is what", "Mystery", 80), | |
Book("FPIS", "Reference", 99), | |
Book("Darker", "Mystery", 80), | |
Book("It isn't", "Romance", 82) | |
) |
This file contains 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 domain.slick | |
import domain.model.{Area, Client, Id} | |
import slick.collection.heterogeneous.HNil | |
import slick.collection.heterogeneous.syntax._ | |
import slick.driver.PostgresDriver.api._ | |
import slick.lifted.{ProvenShape, Query, TableQuery, Tag} | |
class Areas(tag: Tag) extends Table[Area](tag, "areas") { |
This file contains 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 {Injectable, Inject} from "@angular/core"; | |
import {Http} from "@angular/http"; | |
import {Observable, BehaviorSubject} from "rxjs"; | |
@Injectable() | |
export class ThisDataService { | |
private thisData: BehaviorSubject<any[]> = new BehaviorSubject([]); | |
public thisDataObs$: Observable<any[]> = this.thisData.asObservable(); |
This file contains 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
<div class="modal show fade in" role="alert" style="z-index: 2420 !important;"> | |
<div class="modal-backdrop show fade in" style="z-index: 2400 !important;"></div> | |
<div class="modal-dialog modal-md" style="z-index: 2500 !important;"> | |
<div class="modal-content"> | |
<div class="modal-header"> | |
<h2>Confirm {{ actionName }} of {{ itemName }}</h2> | |
</div> | |
<div class="modal-body"> | |
<p>Are you sure you want to {{ actionVerb }} this {{ entityName }}?</p> | |
<p>{{ itemName }}</p> |
This file contains 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 java.time.{Duration, ZonedDateTime} | |
object BruteFast extends App { | |
val startTime = ZonedDateTime.now | |
val theCorrectPassword = "ordaindrooppodlovelyemberlogic" | |
// val theCorrectPassword = "horsebutt" | |
// val dictionary = scala.io.Source.fromFile("/usr/share/dict/words").getLines.toVector | |
val dictionary = Vector("ordain","droop","pod","lovely","ember","logic") |
OlderNewer