Skip to content

Instantly share code, notes, and snippets.

@xicmiah
xicmiah / FlatSttp.scala
Created February 27, 2020 15:20
ResponseAs[F[T], _] instances for sttp 2.x
import sttp.client._
import sttp.model.StatusCode
object FlatSttp {
class FullHttpError(status: StatusCode, body: String)
extends RuntimeException(s"Status code $status: $body")
val asFullError: ResponseAs[FullHttpError, Nothing] = asStringAlways.mapWithMetadata {
case (body, meta) => new FullHttpError(meta.code, body)
}
@xicmiah
xicmiah / Main.scala
Last active February 7, 2018 00:29
Compile-time methods/lines with scala-logging
package example
import com.typesafe.scalalogging._
import org.slf4j.MDC
object Main extends App with PosLogging {
new Foo().doStuff()
Logger(getClass).info("Goodbye, MDC")
@xicmiah
xicmiah / LeakSample.scala
Created May 16, 2016 10:49
Leak example for Observable#firstL
import monix.execution.Scheduler
import monix.reactive.Observable
object LeakSample {
def main(args: Array[String]) {
implicit val scheduler = Scheduler.computation(2)
val hotObservable = (1 +: Observable.never).behavior(0)
hotObservable.connect()
@xicmiah
xicmiah / gist:3985424
Created October 31, 2012 06:26
SNL-config
akka {
actor.provider = "akka.remote.RemoteActorRefProvider"
actor.serialize-messages = off
remote {
transport = "akka.remote.netty.NettyRemoteTransport"
netty {
hostname = localhost
port = 2552
}
@xicmiah
xicmiah / SNL.scala
Created October 29, 2012 11:23
SNL
package com.luxoft.sbrf.cluster.actors
import akka.actor._
import akka.routing._
import akka.util.duration._
import scala.util.Random
import com.google.common.base.Stopwatch
import akka.routing.Broadcast
import akka.routing.RemoteRouterConfig
import com.luxoft.sbrf.cluster.actors.Snl.Calculator.Calculated