Skip to content

Instantly share code, notes, and snippets.

View romangrebennikov's full-sized avatar

Roman Grebennikov romangrebennikov

View GitHub Profile
@romangrebennikov
romangrebennikov / Main.scala
Last active August 29, 2015 14:18
scala-md5 for quest at thedeemon.livejournal.com/99218.html
package mdfive
import java.security.MessageDigest
import akka.actor.{Props, Actor, ActorSystem}
import org.apache.commons.codec.binary.Hex
import scala.annotation.tailrec
class RangeWorker(from:Array[Byte], to:Array[Byte]) extends Actor {
val digest = MessageDigest.getInstance("MD5")
@romangrebennikov
romangrebennikov / list-avg
Created February 4, 2015 12:40
Scala's pimp-my-library example for list average
object ListAvg {
implicit class ListWithAverage(val list:List[Int]) {
def avg:Int = list.sum / list.size
}
}
import ListAvg._
val list = List(1,2,3)
print(list.avg)