View build.sbt
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.sys.process.Process | |
scalaVersion := "2.12.6" | |
libraryDependencies ++= Seq( | |
"com.google.flatbuffers" % "flatbuffers-java" % "1.9.0" | |
) | |
sourceGenerators in Compile += Def.task { | |
val files = (file("src/main/fbs") ** "*.fbs").get.map(_.getAbsolutePath).toList |
View .scalafmt.conf
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
version = "2.0.0-RC4" | |
align = most | |
maxColumn = 100 | |
docstrings = ScalaDoc | |
assumeStandardLibraryStripMargin = true | |
continuationIndent.callSite = 2 | |
continuationIndent.defnSite = 2 | |
align.openParenCallSite = false | |
align.openParenDefnSite = false |
View circe-inmemory-ttfi-di.sc
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
// | |
// @author: Mateusz Kubuszok | |
// | |
// requirements: ammonite 1.1.0 | |
// usage: run `amm` and copy paste into REPL | |
import $ivy.`org.typelevel::cats-core:1.3.1`, cats._, cats.syntax.all._ | |
import $ivy.`org.typelevel::cats-effect:1.0.0`, cats.effect._, cats.effect.syntax._ | |
import $ivy.`io.circe::circe-core:0.9.3`, io.circe._, io.circe.syntax._ | |
import $ivy.`io.circe::circe-generic:0.9.3`, io.circe.generic.auto._ |
View ConsoleJsonWriter.java
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.codahale.metrics.MetricFilter; | |
import com.codahale.metrics.MetricRegistry; | |
import com.fasterxml.jackson.databind.SerializationFeature; | |
import java.io.PrintStream; | |
import java.util.Map; | |
import java.util.Set; | |
import java.util.concurrent.TimeUnit; |
View SangriaReproExample.scala
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
// Imports that you are using | |
import sangria.schema._ | |
import sangria.execution._ | |
import sangria.macros._ | |
import sangria.marshalling.circe._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
// The schema definition |
View OneOf.scala
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
trait OneOf[Obj, Items] | |
object OneOf extends LowPriorityOneOf{ | |
implicit def apply[Obj, Items](implicit oneOf: OneOf[Obj, Items]) = oneOf | |
implicit def left[L, R, Obj <: L] = new OneOf[Obj, L | R]{} | |
} | |
protected trait LowPriorityOneOf extends LowPriorityOneOf1{ | |
implicit def right[L, R, Obj <: R] = new OneOf[Obj, L | R]{} |
View SimplePartitionSample.scala
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 akka.actor.ActorSystem | |
import akka.stream._ | |
import akka.stream.scaladsl._ | |
import scala.io.StdIn | |
import scala.util.Random | |
object SimplePartitionSample extends App { | |
implicit val system = ActorSystem() |
View disable-xdebug.sh
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
#!/bin/sh | |
sed -i.default "s/^zend_extension=/;zend_extension=/" /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini | |
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.php71.plist | |
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php71.plist | |
sudo brew services restart php71 | |
echo "xdebug disabled" |
View refinedMonoid.scala
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
package we.sg.data | |
import cats.kernel.Monoid | |
import eu.timepit.refined.{W, refineMV, refineV} | |
import eu.timepit.refined.api.Refined | |
import eu.timepit.refined.boolean.Not | |
import eu.timepit.refined.string.MatchesRegex | |
object RefinementTypes { |
View a-very-simple-typeclass-example.scala
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
// | |
// While testing the Elasticsearch 6.x http client works for me, using circe for json, | |
// I added a silly `Entity` type class which describes how to get an ID from an entity. | |
// | |
import java.util.UUID | |
import org.apache.http.HttpHost | |
import org.elasticsearch.action.index.IndexRequest |
NewerOlder