Skip to content

Instantly share code, notes, and snippets.

@lregnier
lregnier / AkkaPoolRouter.scala
Last active May 30, 2017 18:05
Akka Pool Router
import akka.actor.{Actor, ActorLogging, ActorSystem, Props}
import akka.event.Logging
import akka.routing.RoundRobinPool
import scala.concurrent.Await
import scala.concurrent.duration._
object RouteeActor {
def props(): Props = Props[RouteeActor]
}
import akka.actor.{Actor, ActorIdentity, ActorLogging, ActorRef, FSM, Identify, Props, Stash, Terminated}
import scala.concurrent.duration.{Duration, _}
object RemoteActorProxy {
sealed trait State
case object Identifying extends State
case object Active extends State
@lregnier
lregnier / scala-with-style-by-martin-odersky.md
Last active March 16, 2023 21:41
Scala with Style, by Martin Odersky

Keybase proof

I hereby claim:

  • I am lregnier on github.
  • I am lregnier (https://keybase.io/lregnier) on keybase.
  • I have a public key ASB1FV_t35RpiUaURaAugxtwNPDaSQZlhBUUjNFT4J1x5Ao

To claim this, I am signing this object:

@lregnier
lregnier / ActorCaching.scala
Created April 27, 2018 15:56
Akka's ActorCaching
import akka.actor.{Actor, ActorLogging, ExtendedActorSystem, Extension, ExtensionId, ExtensionIdProvider}
import akka.pattern.pipe
import com.typesafe.config.Config
import scala.concurrent.Future
import scala.concurrent.duration.Duration
object ActorCaching {
case class SaveToCache(msg: Any, response: Any)
case class RemoveFromCache(msg: Any)
@lregnier
lregnier / SynchronousVsAsynchronousSpec.scala
Created May 11, 2018 18:23
SynchronousVsAsynchronousSpec
import akka.actor.{Actor, ActorSystem, Props}
import akka.testkit.{ImplicitSender, TestActorRef, TestKit}
import org.scalatest.WordSpecLike
import scala.concurrent.duration._
class SynchronousVsAsynchronousSpec
extends TestKit(ActorSystem("synchronous-vs-asynchronous-spec"))
with ImplicitSender
with WordSpecLike {
import java.util.Date
import com.auth0.jwt.algorithms.Algorithm
import com.auth0.jwt.interfaces.DecodedJWT
import com.auth0.jwt.{JWT => Auth0JWT}
import com.typesafe.config.Config
import scala.util.Try
object JWT {