Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| import play.api.libs.json._ | |
| import play.api.data.validation.ValidationError | |
| object Test{ | |
| type Tagged[U] = { type Tag = U } | |
| trait NonEmpty | |
| type NonEmptyString = String with Tagged[NonEmpty] |
| #!/usr/bin/env zsh | |
| # in fino veritas | |
| # Borrowing shamelessly from these oh-my-zsh themes: | |
| # fino-time | |
| # pure | |
| # https://gist.github.com/smileart/3750104 | |
| # Set required options |
| # How Akka maps to EAI Patterns | |
| Might be up for debate or just plain wrong. Just some notes I scribbled down some time ago. | |
| ----------------------------------------------------------------------------------------------------------------- | |
| EAI PATTERN AKKA PATTERN REFERENCE | |
| ----------------------------------------------------------------------------------------------------------------- | |
| Point to Point Channel Regular Actor Communication http://www.eaipatterns.com/PointToPointChannel.html | |
| Event-Driven Consumer Regular Actor Receive http://www.eaipatterns.com/EventDrivenConsumer.html | |
| Message Selector Actor with Stash http://www.eaipatterns.com/MessageSelector.html |
| # Scaladoc Developer Guide | |
| ## Introduction | |
| Scaladoc is the tool that enables developers to automatically generate documentation for their Scala (and Java) projects. It is Scala's equivalent of the widely-used Javadoc tool. This means that Javadoc (and even doxygen) users will be familiar with Scaladoc from day 1: for them, it is most beneficial to check out the Scaladoc/Javadoc comparison tables and if necessary, skim through this document to understand specific features. | |
| The rest of this tutorial is aimed at developers new to Scaladoc and other similar tools. It assumes a basic understanding of the Scala language, which is necessary to follow the examples given throughout the tutorial. For the user perspective on the Scaladoc-generated documentation, such as finding a class, understanding the page layout, navigating through diagrams, please refer to the Scaladoc User Guide. | |
| The tutorial will start by a short motivation and then will explain the main concept in Scaladoc: the doc comment. | |
| ### Why document? |
| def Secured[A](username: String, password: String)(action: Action[A]) = Action(action.parser) { request => | |
| request.headers.get("Authorization").flatMap { authorization => | |
| authorization.split(" ").drop(1).headOption.filter { encoded => | |
| new String(org.apache.commons.codec.binary.Base64.decodeBase64(encoded.getBytes)).split(":").toList match { | |
| case u :: p :: Nil if u == username && password == p => true | |
| case _ => false | |
| } | |
| }.map(_ => action(request)) | |
| }.getOrElse { | |
| Unauthorized.withHeaders("WWW-Authenticate" -> """Basic realm="Secured"""") |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| import scala.collection.mutable.ListBuffer | |
| import akka.actor.{Actor,ActorRef} | |
| import akka.actor.Actor._ | |
| import akka.routing.{ Listeners, Listen } | |
| //Represents a domain event | |
| trait Event | |
| //A builder to create domain entities | |
| trait EntityBuilder[Entity] { |