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 mytest | |
import org.specs2.execute.Details | |
import org.specs2.mutable._ | |
import org.specs2.reporter.Notifier | |
class MyNotifier extends Notifier { | |
override def exampleFailure(name: String, message: String, |
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
trait PropertyType { | |
def price: Double | |
} | |
case class House(price: Double, noOfBedRooms: Option[Short]) extends PropertyType | |
case class Land(price: Double, area: Option[Double]) extends PropertyType | |
object House { | |
implicit val houseReads: Reads[House] = ( | |
(JsPath \ "price").read[Double] and |
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 rest.spray.service | |
import akka.actor.Actor | |
import reactivemongo.api.MongoDriver | |
import reactivemongo.bson.{BSONDocument, BSONDocumentReader, BSONObjectID, Macros} | |
import spray.httpx.SprayJsonSupport._ | |
import spray.json._ | |
import spray.routing._ | |
import scala.concurrent.Future |
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 com.example | |
import akka.actor.Actor | |
import reactivemongo.api.MongoDriver | |
import reactivemongo.bson.{BSONDocument, BSONDocumentReader, BSONObjectID, Macros} | |
import spray.httpx.SprayJsonSupport._ | |
import spray.json._ | |
import spray.routing._ | |
import scala.concurrent.Future | |
import scala.util.{Failure, Success} |
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
(ns reverse-words | |
(use [clojure.contrib.str-utils]) | |
(:import (java.io BufferedReader FileReader))) | |
(defn reverse-words [file-name] | |
(with-open [reader (BufferedReader. (FileReader. file-name))] | |
(let [lines (line-seq reader) | |
n (Integer/parseInt (first lines))] | |
(doseq [[xs i] (map vector (rest lines) (range 1 (inc n)))] | |
(println (str "Case #" i ":") |
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
(ns store-credit | |
(use [clojure.contrib.str-utils]) | |
(:import (java.io BufferedReader FileReader))) | |
(defn sum-items [v i] | |
(let [h (first v) | |
r (rest v) | |
j (atom i)] | |
(if (empty? v) | |
[] |
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
#!/bin/zsh | |
emulate -L zsh | |
b=(1 2 2 4 5 10 10 20 25 50 50 100 100 200 200 400 400 800 800 1600 1600 3200 3200 6400 6400 12800) | |
c=1 | |
rt=5 | |
while [ "$c" -le "${#b}" ]; do | |
for i in {$rt..0}; do | |
sleep 1 | |
print -n "Time: ${(l:2::0:)$((i/60))}:${(l:2::0:)$((i%60))} Blinds: $b[$c], $b[$c+1]\r" |
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
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"title": "Product", | |
"type": "object", | |
"properties": { | |
"id": { | |
"description": "The unique identifier for a product", | |
"type": "number" | |
}, | |
"name": { |
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
{ | |
"definitions": { | |
"writer": { | |
"type": "object", | |
"properties": { | |
"name": { | |
"type": "string" | |
}, | |
"books": { | |
"type": "array", |
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
public class LDAPUserVerifierTest extends ESTestWithMockServer { | |
@BeforeClass | |
public static void beforeClass() { | |
startEMFStore(); | |
} | |
@AfterClass | |
public static void afterClass() { | |
stopEMFStore(); |
OlderNewer