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
| using System.Collections; | |
| using System.Collections.Generic; | |
| namespace Immutable | |
| { | |
| public sealed class LList<T> : IReadOnlyCollection<T> | |
| { | |
| public T Head { get; } | |
| public LList<T> Tail { get; } | |
| public bool IsEmpty { get; } |
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
| let inline is_null (x:^T when ^T : not struct) = obj.ReferenceEquals (x, null) | |
| let inline (!>) (x:^a) : ^b = ((^a or ^b) : (static member op_Implicit : ^a -> ^b) x) | |
| let inline (^) f x = f x | |
| let inline (~%) x = ignore x |
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.Implicits.global | |
| import scala.concurrent.duration._ | |
| import scala.concurrent.{Await, Future} | |
| import scalaz.{Monad, StateT} | |
| import scalaz.std.AllInstances._ | |
| object Test extends App { | |
| implicit val ifsmi = StateT.stateTMonadState[Int, Future] | |
| import ifsmi.{get, put} |
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
| __author__ = 'Daniil <danslapman> Smirnov' | |
| __copyright__ = 'Copyleft 2013, danslapman' | |
| __contact__ = 'https://bitbucket.org/danslapman/memoize' | |
| def memoize(cache): | |
| def memoize(fun): | |
| def memoizator(*args, **kwargs): | |
| if args in cache: | |
| return cache[args] | |
| else: |
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
| val book = | |
| ('author ->> "Benjamin Pierce") :: | |
| ('title ->> "Types and Programming Languages") :: | |
| ('id ->> 262162091) :: | |
| ('price ->> 44.11d) :: | |
| HNil | |
| def readBook[B <: HList](book:B)(implicit | |
| author: Selector.Aux[B, Witness.`'author`.T, String], | |
| title: Selector.Aux[B, Witness.`'title`.T, String], |
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: Obtain Amazon ECR token | |
| shell: | | |
| docker run -i --rm \ | |
| -e "AWS_KEY={{ amazon_ecr_aws_key }}" \ | |
| -e "AWS_SECRET_KEY={{ amazon_ecr_aws_secret_key }}" \ | |
| opedge/awscli:latest \ | |
| aws ecr --region us-east-1 get-authorization-token | |
| register: ecr_token_result |
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()) | |
| } |
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
| 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
| 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} |
OlderNewer