Skip to content

Instantly share code, notes, and snippets.

@mads-hartmann
mads-hartmann / bundles.sh
Created December 7, 2010 16:04
This is how I manage my textmate bundles.
#
# This script will install the following Textmate bundles
#
# Languages
# - c https://github.com/textmate/c.tmbundle
# - coffeescript https://github.com/jashkenas/coffee-script-tmbundle
# - context free https://github.com/textmate/context-free.tmbundle
# - erlang https://github.com/textmate/erlang.tmbundle
# - haskell https://github.com/textmate/haskell.tmbundle.git
# - html https://github.com/textmate/html.tmbundle
package com.banksimple.testing.util
import akka.actor._
class ReplayActor extends Actor {
var lastSeen: List[Any] = List()
override def receive: Receive = {
case 'dump => { self.reply(lastSeen) ; lastSeen = List() }
case a => lastSeen = a :: lastSeen
}
}
@viktorklang
viktorklang / CQRS_ES_Actor.scala
Created February 1, 2011 15:05
CQRS and EventSourcing using Akka Actors
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] {
// ###########################################################
//
// Demonstrates how to supervise an Akka consumer actor.
//
// The consumer consumes messages from a file endpoint:
// - successful message processing by the consumer will
// positively acknowledge the message receipt, causing
// the file endpoint to delete the file.
// - an exception during message processing will cause a
// supervisor to restart the consumer. Before restart,
@softprops
softprops / TypeClasses.scala
Created February 20, 2011 05:21
trying to recollect type class teachings of Mark Harrah
trait Builder[M[_], N[_]] {
type Apply[T] = M[N[T]]
}
implicit def optionIntListBuilder: Builder[List, Option]#Apply[Int] = List.empty[Option[Int]]
// make a list of option[T]
def make[T](implicit p: Builder[List, Option]#Apply[T]): List[Option[T]] = p
make[Int] // List[Option[Int]]
@tlockney
tlockney / ImplicitExample.scala
Created February 23, 2011 03:49
Here's a very simplified example of hiding an implicit in a companion object
// initial version
import scala.collection.immutable.TreeSet
class TreeMember[A] {
// some really important stuff here, of course! ;~)
}
class Main {
implicit val treeOrder = new Ordering[TreeMember[A]] {
def compare(a: TreeMember[A], b: TreeMember[A]) = {
// elided for simplicity's sake
}
import java.io.File
import sbt._
class Project(info: ProjectInfo) extends ParentProject(info) with IdeaProject {
lazy val mavenLocal = "Local Maven Repository" at "file://"+Path.userHome+"/.m2/repository"
lazy val geotoolsRepository = "Open Source Geospatial Foundation Repository" at "http://download.osgeo.org/webdav/geotools/"
lazy val javanetRepository = "Java.net Repository" at "http://download.java.net/maven/2"
lazy val iglootoolsRepository = "Iglootools Releases Repository" at "http://developers.sirika.com/maven2/releases/"
lazy val jbossRepository = "JBoss Releases Repository" at "https://repository.jboss.org/nexus/content/groups/public-jboss"
lazy val hibernateSpatial = "Hibernate Spatial Repository" at "http://www.hibernatespatial.org/repository"
@bwmcadams
bwmcadams / org.mongodb.mongod.plist
Created March 2, 2011 23:59
Suggested Plist for Mac MongoDB 1.8+, enables durability and clean shutdown
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.mongodb.mongod</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/mongodb/bin/mongod</string>
<string>run</string>
@momania
momania / gist:858476
Created March 7, 2011 13:05
Akka AMQP Loadbalance
import akka.amqp.AMQP._
import akka.amqp._
import akka.actor._
import java.util.concurrent.{TimeUnit, CountDownLatch}
import util.Random
object LoadBalancingDemo {
def main(args: Array[String]) {
@softprops
softprops / 1.md
Created March 16, 2011 06:05
a.md

towards composibility

language is representation (data structures) and combination (control structures)

goals of a language: simplification => easy to express "what" it is you're trying to do

simplification => generalization

towards composability