This file contains hidden or 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
#000000,#AAAAAA,#777777,#FFFFFF,#666666,#FFFFFF,#999999,#BBBBBB |
This file contains hidden or 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
//https://github.com/mongodb/mongo-scala-driver/blob/master/bson/src/main/scala/org/mongodb/scala/bson/DefaultHelper.scala | |
/** | |
* Neat helper to obtain a default type should one not be given eg: | |
* | |
* {{{ | |
* def find[T]()(implicit e: T DefaultsTo Document) { ... } | |
* }}} | |
* | |
* The signature of the `find` method ensures that it can only be called if the caller can supply an object of type |
This file contains hidden or 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 shapeless._ | |
import shapeless.labelled.FieldType | |
import shapeless.ops.record.Selector | |
import scala.annotation.implicitNotFound | |
/* | |
Witnesses, that all fields of `Projection` exists in `Source` with the same types and names | |
*/ | |
@implicitNotFound("${Projection} is not a valid projection of ${Source}") |
This file contains hidden or 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
def inRange(start: LocalTime, end: LocalTime)(dt: LocalDateTime) = { | |
val time = dt.toLocalTime | |
if (start.isBefore(end)) | |
(time.isAfter(start) || time == start) && time.isBefore(end) | |
else | |
(time.isAfter(start) || time == start) ^ time.isBefore(end) | |
} |
This file contains hidden or 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 $ivy.`org.typelevel::cats-core:2.0.0` | |
import $plugin.$ivy.`org.typelevel::kind-projector:0.10.3` | |
import cats._ | |
import cats.instances.option._ | |
import cats.syntax.all._ | |
import scala.annotation.tailrec | |
def next(offset: Int): Option[Vector[Int]] = if (offset < 50) Vector.tabulate(10)(identity).some else Vector.empty[Int].some |
This file contains hidden or 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.concurrent.{ExecutionContext, Future, Promise} | |
import cats.instances.future._ | |
import cats.syntax.functor._ | |
import com.timcharper.acked.AckTup | |
import shapeless.{Nat, Sized} | |
import shapeless.syntax.sized._ | |
import shapeless.ops.nat.ToInt | |
object AckedReplicate { | |
def replicateN[T, N <: Nat](implicit size: ToInt[N]): AckTup[T] => Sized[List[AckTup[T]], N] = { |
This file contains hidden or 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.free.Trampoline | |
import cats.instances.stream._ | |
import cats.instances.try_._ | |
import cats.syntax.nested._ | |
import cats.syntax.traverse._ | |
import reactivemongo.bson._ | |
import scala.util.{Failure, Success, Try} | |
implicit class BSONValueOps(private val bv: BSONValue) extends AnyVal { |
This file contains hidden or 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
case class TEnum[P[_], R, A](repr: P[R], ve: ValueEnum[R, A])(implicit val ev: A <:< ValueEnumEntry[R]) extends TType[P, A] | |
.. | |
def tEnum[I, E](repr: Schema[TSchema, I], ve: ValueEnum[I, E])(implicit ev: E <:< ValueEnumEntry[I]): Schema[TSchema, E] = | |
prim(HMutu(TEnum(repr, ve))) | |
.. | |
override val encoder: TSchema ~> Encoder = new (TSchema ~> Encoder) { |
This file contains hidden or 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 org.scalactic.Prettifier | |
import reactivemongo.bson._ | |
implicit val bdocPrettifier = Prettifier({ | |
case doc: BSONDocument => BSONDocument.pretty(doc) | |
}) |
This file contains hidden or 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
cat /usr/local/etc/sbtopts | |
# ------------------------------------------------ # | |
# The SBT Configuration file. # | |
# ------------------------------------------------ # | |
-J-Xmx6G |