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 java.nio.charset.StandardCharsets._ | |
import java.security._ | |
import javax.crypto._ | |
import javax.crypto.spec._ | |
import base64.Encode.{ apply => toBase64 } | |
import base64.Encode.{ urlSafe => toBase64UrlSafe } | |
import base64.Decode.{ apply => fromBase64 } | |
import base64.Decode.{ urlSafe => fromBase64UrlSafe } |
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
/** | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2013-2015 Andrew Snare, Age Mooij | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
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 com.typesafe.sbt.SbtStartScript | |
seq(SbtStartScript.startScriptForClassesSettings: _*) | |
seq(Revolver.settings: _*) | |
name := "demo" | |
organization := "com.scalapenos" |
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
[info] Compiling 1 Scala source to /Users/age/Development/src/agemooij/riak-scala-client/target/scala-2.10/test-classes... | |
01/19 23:59:09 DEBUG [akka://default/user/test-server]: SERVER: Starting akka://default/user/test-server on localhost/127.0.0.1:17249 | |
01/19 23:59:09 INFO [akka://default/user/io-bridge]: akka://default/user/io-bridge started | |
01/19 23:59:09 DEBUG [akka://default/user/io-bridge]: SERVER: Executing Bind(localhost/127.0.0.1:17249,100,LogMark(SERVER)) | |
01/19 23:59:09 INFO [akka://default/user/test-server]: SERVER: akka://default/user/test-server started on localhost/127.0.0.1:17249 | |
01/19 23:59:09 DEBUG [akka://default/user/http-client/$a]: Opening connection 1 to localhost:17249 | |
01/19 23:59:09 DEBUG [akka://default/user/io-bridge]: Executing Connect(localhost/127.0.0.1:17249,None,()) | |
01/19 23:59:09 DEBUG [akka://default/user/io-bridge]: Connection request registered | |
01/19 23:59:09 DEBUG [akka://default/user/io-bridge]: SERVER: New connection accepted on localhost/127.0.0.1:17249 | |
01/19 23:59:0 |
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 SprayAdaptiveGzipSupport extends directives.EncodingDirectives { | |
import spray.httpx.encoding._ | |
def withAdaptiveCompressionSupport: Directive0 = | |
(decodeRequest(NoEncoding) | decodeRequest(Gzip) | decodeRequest(Deflate)) & | |
(encodeResponse(NoEncoding) | encodeResponse(Gzip) | encodeResponse(Deflate)) | |
} | |
object SprayAdaptiveGzipSupport extends SprayAdaptiveGzipSupport |
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
scala> :paste | |
// Entering paste mode (ctrl-D to finish) | |
def wrap(partial: PartialFunction[Any, Unit]): PartialFunction[Any, Unit] = new PartialFunction[Any, Unit] { | |
def isDefinedAt(a: Any): Boolean = partial.isDefinedAt(a) | |
def apply(a: Any): Unit = { | |
println("----> received " + a) | |
partial.apply(a) | |
} | |
} |
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 LinearFit2 { | |
case class Point(x: Double = 0.0, y: Double = 0.0) { | |
def +(that: Point): Point = Point(this.x + that.x, this.y + that.y) | |
} | |
implicit def tupleToPoint(tuple: (Double, Double)): Point = Point(tuple._1, tuple._2) | |
def through (points : Point*) : Point = through(points.toList) | |
def through (points : List[Point]) : Point = { | |
val total = points.foldLeft(Point())(_ + _) |
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
package com.agemooij.test | |
import java.util.Date | |
import org.junit.runner.RunWith | |
import org.scalatest.junit.JUnitRunner | |
import org.scalatest.FlatSpec | |
import org.scalatest.matchers.ShouldMatchers | |
import com.mongodb.casbah.Imports._ |
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
package com.agemooij.mongodb | |
import com.mongodb.casbah.Imports._ | |
trait MongoRepository { | |
protected val host = "localhost" | |
protected val port = 27017 | |
protected val databaseName = "agemooij" | |
protected val collectionName: String |
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
repositories { | |
.... | |
add(new org.apache.ivy.plugins.resolver.URLResolver()) { | |
name = "GitHub" | |
addArtifactPattern 'http://github.com/asikkema/adoptimizer/downloads/[organization]-[module]-[revision].[ext]' | |
} | |
} |