Skip to content

Instantly share code, notes, and snippets.

project/build.properties

sbt.version=0.12.0

build.sbt

import com.typesafe.sbt.SbtStartScript
@2m
2m / gist:9660966
Created March 20, 2014 10:28
akka receive implementation using scala and java lamda
// scala
def receive = {
case Counter.Inc(by) => count += by
case Counter.Current => sender ! Counter.CurrentReply(count)
}
// java lamda
@Override
public PartialFunction<Object, BoxedUnit> receive() {
return ReceiveBuilder.
@2m
2m / gist:9779204
Last active August 29, 2015 13:57

TimeMap Waterloo 1H

Single user and 4 threads

Workers - 2 4 6 Avg resp time - 2643ms 2521ms 2610ms

navigateTo(url) {
in(form having id("form1")) {
in(input having id("iLogin")) {
typeIn(username)
}
in(input having id("iPassword")) {
typeIn(password)
}
in(input having name("doLogin")) {
click ==>
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import java.util.Map;
import java.util.HashMap;
public class ConfigOverrideFromCode {
static public void main(String[] args) {
String config = "system {\n" +
" administrator = ${who-knows}\n" +
@2m
2m / Main.java
Last active August 29, 2015 14:05
// place this in src/main/java/
public class Main {
public static void main(String[] args) {
System.out.println("Hello world");
}
}
@2m
2m / stream.scala
Last active August 29, 2015 14:05
scala> Stream.from(3).takeWhile(_ => new Random().nextDouble() > 0.1).force
res9: scala.collection.immutable.Stream[Int] = Stream(3, 4, 5, 6, 7, 8, 9)
@2m
2m / Main.scala
Created September 2, 2014 09:11
Stackable trait with context.become
package stackable
import akka.actor.{Props, ActorSystem, Actor}
object Main extends App {
val sys = ActorSystem("stackable")
val act = sys.actorOf(Props[EchoActor])
act ! "BooHoo"
act ! "BooHoo"
@2m
2m / gist:7a5443cee96541a98870
Created September 15, 2014 15:45
podcasts
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.1">
<head>
<title>BeyondPod Feeds</title>
<dateCreated>Sun, 24 Aug 2014 12:39:43 GMT+03:00</dateCreated>
<dateModified>Sun, 24 Aug 2014 12:39:43 GMT+03:00</dateModified>
</head>
<body>
<outline text="Security">
<outline text="Security Now (MP3)" xmlUrl="http://leoville.tv/podcasts/sn.xml" type="rss" />
@2m
2m / gist:d09b74ba379898a4f01e
Created October 31, 2014 12:19
Ciklas cikle
case class Request(valid: Boolean, impressions: Seq[Impression])
case class Impression(rules: Seq[Rule])
case class Rule(valid: Boolean)
case class Bid(money: Double)
// generate some random requests
val requests = Vector.fill(5) {
Request(