This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
port = 8080 | |
if sys.version_info.major == 3: | |
import http.server | |
import socketserver | |
handler = http.server.SimpleHTTPRequestHandler | |
httpd = socketserver.TCPServer(("",port), handler) | |
elif sys.version_info.major == 2: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// flat <-> hierarchical conversions | |
import java.util | |
import java.util.regex.Pattern | |
import scala.collection.JavaConversions._ | |
import com.typesafe.config.{Config, ConfigFactory, ConfigList, ConfigObject, ConfigUtil} | |
import com.typesafe.scalalogging.StrictLogging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.reflect.ClassTag | |
trait Expr | |
case class Not(expr: Expr) extends Expr { | |
override def toString = s"!$expr" | |
} | |
case class Value[T](t: T) extends Expr { | |
override def toString = s"$t" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.typesafe.config.{Config, ConfigFactory} | |
import scala.language.{existentials, higherKinds, implicitConversions} | |
trait Monoid[T] { | |
def mapply(a: T, b: T): T | |
def mzero: T | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hlist definition | |
sealed trait HList | |
case class HPair[A, B <: HList](head: A, tail: B) extends HList { | |
override def toString = Seq(head, tail).mkString(" ::: ") | |
} | |
case object HNil extends HList | |
// instantiation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-server | |
-ea | |
-noverify | |
-Xms1024m | |
-Xmx2048m | |
-XX:+UseG1GC | |
-XX:-UseParNewGC | |
-XX:-UseConcMarkSweepGC | |
-XX:ReservedCodeCacheSize=240m | |
-XX:+OmitStackTraceInFastThrow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import OT.{OT1, OT2} | |
import _root_.io.circe._ | |
import _root_.io.circe.generic.semiauto._ | |
import _root_.io.circe.syntax._ | |
import io.circe.parser._ | |
//import _root_.io.circe.java8.time._ | |
decode[List[Int]](List(123, 456).asJson.noSpaces) | |
sealed trait ST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.Foldable | |
import shapeless.ops.product._ | |
import shapeless.ops.tuple._ | |
import cats._ | |
import cats.implicits._ | |
trait Pipeline[+A] { | |
@inline def map[B](f: A => B): Pipeline[B] | |
@inline def flatMap[B](f: A => Pipeline[B]): Pipeline[B] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats._ | |
import cats.implicits._ | |
trait Service[R[_]] { | |
type Result[T] = R[T] | |
def computeValue(): Result[Int] | |
} | |
class ServiceImpl[R[_] : Monad : Foldable] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.circe._ | |
import io.circe.parser._ | |
import io.circe.syntax._ | |
import io.circe.generic.decoding._ | |
import io.circe.generic.encoding._ | |
import io.circe.generic.semiauto._ | |
case class GenericModel[Payload](payload: Payload, value: String) | |
case class TestPayload() |
OlderNewer