Skip to content

Instantly share code, notes, and snippets.

# to install the latest stable version:
brew install scala --with-docs
# to install scala-2.10.0-RC1:
brew install https://raw.github.com/gist/3939012/scala.rb --with-docs
# to switch versions (from https://github.com/mxcl/homebrew/wiki/External-Commands):
brew switch scala 2.9.2
brew switch scala 2.10.0-RC1
package org.kafecho.learning.monad
import java.util.UUID
/** My attempt at implementing the Reader Monad concept.
* The Reader Monad encapsulates a computation which:
* - requires a dependency of type D
* - produces values of type A.
*/
case class Reader[D, A](computation: D => A) {

Akka Cluster Implementation Notes

Slightly disorganized but reasonably complete notes on the algorithms, strategies and optimizations of the Akka Cluster implementation. Could use a lot more links and context etc., but was just written for my own understanding. Might be expanded later.

Links to papers and talks that have inspired the implementation can be found on the 10 last pages of this presentation.

Akka Gossip

Gossip state

This is the Gossip state representation:

import scalaz._
import Scalaz._
object monads {
def fix[A](f: (=> A) => A): A = f(fix(f)) //> fix: [A](f: => A => A)A
type Gen[A] = (=> A) => A
def gFib: Gen[Int => Int] = (self) => n =>
Recurly.subdomain = ENV['RECURLY_SUBDOMAIN']
Recurly.api_key = ENV['RECURLY_API_KEY']
Recurly.js.private_key = ENV['RECURLY_JS_PRIVATE_KEY']
Recurly.default_currency = 'USD'
diff --git a/README.md b/README.md
index 0782789..0cb6f6a 100644
--- a/README.md
+++ b/README.md
@@ -172,7 +172,7 @@ in Scala flows from left-to-right, can require fewer type annotations.
every possible extension method. This should also help compiler performance,
by reducing the implicit search space.
* Syntax is layered in the same way as type classes. Importing the syntax for, say, `Applicative`
- will also provide the syntax for `Pointed` and `Functor`.
+ will also provide the syntax for `Apply` and `Functor`.
diff --git a/README.md b/README.md
index 0782789..0cb6f6a 100644
--- a/README.md
+++ b/README.md
@@ -172,7 +172,7 @@ in Scala flows from left-to-right, can require fewer type annotations.
every possible extension method. This should also help compiler performance,
by reducing the implicit search space.
* Syntax is layered in the same way as type classes. Importing the syntax for, say, `Applicative`
- will also provide the syntax for `Pointed` and `Functor`.
+ will also provide the syntax for `Apply` and `Functor`.
require 'openssl'
key = "SYMETRIC KEY"
data = "DATA TO SIGN"
p OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new('sha1'), key, data)
import scala.concurrent._
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits._
import scala.util.{ Success, Failure }
import akka.actor._
import akka.pattern.{ after, ask, pipe }
import akka.util.Timeout
object LogSearch extends App {
package psp
import sbt._, Keys._, scala.util.Try
package object stub extends stub.LibSbtStub {
lazy val props = new SbtBuildProps()
lazy val pspBintray = new Bintray("paulp")
def buildSettings = quietSettings ++ Seq(resolvers ++= pspBintray.repos) ++ addSbtPlugin(pspOrg % "psp-libsbt" % dependVersion)
def projectSettings = quietSettings