Skip to content

Instantly share code, notes, and snippets.

import play.api.libs.json.Json
val j= """
|[
| {
| "_key": "A1",
| "name": "Foo and Bar",
| "contents": [
| {
| "Android Wear": [
| "Notifications",
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"
)
- 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
case class Yard(yardId: Id[Yard], clientId: Id[Client], yardName: String, deleted: Boolean) extends Location with ClientManaged
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 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)
)
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") {
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();
<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>
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")