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 $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
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 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
//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
#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
@derive(encoder(identity, Some("statusCode"))) | |
sealed trait Result[T] | |
object Result { | |
implicit val swaggerConfig: SwaggerTypeable.Config = | |
SwaggerTypeable.defaultConfig.withDiscriminator("statusCode") | |
.copy(mangleTypeParams = false) | |
implicit def typeable[T: Tag](implicit tType: SwaggerTypeable[T]): SwaggerTypeable[Result[T]] = { | |
val updateRefName: Endo[SwaggerType] = | |
(SwaggerType.refPrism >> SwaggerRef.name) |
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.`com.propensive::contextual-core:3.0.1` | |
import java.time.format.DateTimeFormatter | |
import scala.language.experimental.macros | |
import contextual._ | |
object dateTimeFormat { | |
object DateTimeFormatInterpolator extends Interpolator { |
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
package sbt | |
import sbt.Keys._ | |
import sbt.internal.inc.HashUtil | |
import sbt.internal.remotecache.CustomRemoteCacheArtifact | |
import sbt.nio.FileStamp | |
import sbt.nio.file.FileAttributes | |
import sbt.plugins.JvmPlugin | |
import sbt.util.InterfaceUtil.toOption |
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/fsprojects/fantomas/blob/master/docs/Documentation.md | |
[*.{fs,fsx}] | |
indent_size=4 | |
max_line_length=120 | |
fsharp_max_value_binding_width=120 | |
fsharp_max_function_binding_width=120 | |
fsharp_multiline_block_brackets_on_same_column=true | |
fsharp_multi_line_lambda_closing_newline=true | |
fsharp_multiline_block_brackets_on_same_column = true | |
fsharp_experimental_stroustrup_style = true |