Skip to content

Instantly share code, notes, and snippets.

View hamnis's full-sized avatar

Erlend Hamnaberg hamnis

View GitHub Profile
@hamnis
hamnis / SseClient.scala
Last active August 26, 2020 08:23 — forked from izeigerman/SseClient.scala
Complete SSE client Implementation for Scala using http4s.
import cats.effect.Timer
import fs2.{Pull, RaiseThrowable, Stream}
import org.http4s._
import org.http4s.ServerSentEvent.EventId
import org.http4s.client.Client
import org.http4s.headers.{Accept, `Cache-Control`}
import scala.concurrent.duration._
import SseClient._
@hamnis
hamnis / 0_reuse_code.js
Created June 2, 2014 06:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
trait JsonParser extends BodyParserModule {
def parse[String, O <: Parser[O]](a: String)(implicit Parser: O): O = a match {
case Parser(o) => o
case _ => ???
}
}
sealed trait Parser[A] {
def parse(a: String): A