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 java.time._ | |
| import java.time.format.{DateTimeFormatter, DateTimeFormatterBuilder} | |
| import java.time.temporal.{ChronoField, TemporalAccessor} | |
| import java.{time => jt} | |
| import scala.util.Try | |
| trait ZonedParser { | |
| protected val formatter: DateTimeFormatter |
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
| interp.configureCompiler(_.settings.YpartialUnification.value = true) |
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 coursierapi.MavenRepository | |
| interp.repositories.update(interp.repositories() ::: List(MavenRepository.of( | |
| "http://dl.bintray.com/danslapman/maven" | |
| )) | |
| @ | |
| import $ivy.`danslapman::shapeless-circe:1.0` | |
| import $plugin.$ivy.`org.spire-math::kind-projector:0.9.7` |
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.util.{Success, Try} | |
| val pf1: PartialFunction[Try[String], String] = { | |
| case Success(s) => s | |
| } | |
| val pf2: PartialFunction[String, String] = { | |
| case s if s.contains("pass") => s | |
| } |
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
| copyProbeClasses := { | |
| val log = streams.value.log | |
| val probeTarget = new File(crossTarget.value, "probe-classes") | |
| (probeTarget ** "*" filter(_.isFile)).get.foreach { fl => | |
| log.info("Copying " + fl.relativeTo(probeTarget).get.toString) | |
| Files.copy(fl.toPath, new File((classDirectory in Compile).value, fl.relativeTo(probeTarget).get.toString).toPath, REPLACE_EXISTING) | |
| } | |
| } |
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
| name := "sbt-scopes" | |
| version := "0.1" | |
| scalaVersion := "2.12.4" | |
| lazy val Probe = config("probe").intransitive | |
| .extend(Compile) | |
| .describedAs("Probe configuration") |
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 ru.tinkoff.testApi | |
| import akka.actor.ActorSystem | |
| import akka.http.scaladsl.Http | |
| import akka.stream.ActorMaterializer | |
| import io.circe.generic.JsonCodec | |
| import ru.tinkoff.tschema.akkaHttp.{MkRoute, Serve} | |
| import ru.tinkoff.tschema.swagger.SwaggerTypeable | |
| import ru.tinkoff.tschema.typeDSL.DSLAtom | |
| import shapeless.{HList, Witness} |
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
| type LazyFuture[T] = ReaderT[Future, ExecutionContext, T] | |
| object LazyFuture { | |
| def apply[T](value: => T): LazyFuture[T] = ReaderT.apply { implicit ExecutionContext => | |
| Future(value) | |
| } | |
| } |
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 linecache | |
| def PrintException(): | |
| exc_type, exc_obj, tb = sys.exc_info() | |
| f = tb.tb_frame | |
| lineno = tb.tb_lineno | |
| filename = f.f_code.co_filename | |
| linecache.checkcache(filename) | |
| line = linecache.getline(filename, lineno, f.f_globals) | |
| print 'EXCEPTION IN ({}, LINE {} "{}"): {}'.format(filename, lineno, line.strip(), exc_obj) |
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
| implicit class PowerOp[T <: AnyVal](val value: T) extends AnyVal { | |
| import Numeric.Implicits._ | |
| import scala.{math => scmath} | |
| @inline def **(power: T)(implicit numeric: Numeric[T]): Double = | |
| scmath.pow(value.toDouble(), power.toDouble()) | |
| } |