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
from typing import List | |
def perm(input: str) -> List[str]: | |
return [ | |
head + p | |
for i, head in enumerate(input) | |
for p in perm(input[:i] + input[i+1:]) | |
] if input else [input] | |
print(perm('abc')) |
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
FROM node:10.15.1-alpine as build | |
WORKDIR /var/www | |
COPY ./package-lock.json ./package.json ./ | |
RUN npm ci | |
COPY . . |
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 get_total_pairs(nums, total): | |
return [(x, y) for y in nums for x in nums if x + y == total] | |
if __name__ == '__main__': | |
print(get_total_pairs([1, 2, 3, 4, 5, 6, 7, 8, 9], 10)) |
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
class MatchError(BaseException): | |
pass | |
class Lexer: | |
tokens = [] | |
def __init__(self, source): | |
self.index = 0 | |
self.lineno = 0 |
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.parsing.combinator._ | |
val enum = List("chemotherapy", "surgery", "toxicity") | |
type CohortType = (List[String], Option[List[String]]) | |
object CohortParser extends RegexParsers { | |
val fail: CohortType = List() -> None | |
private lazy val colon = ":" |
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.~> | |
import cats.free._ | |
import Free._ | |
import Op.interpreter.state | |
import cats.instances.either._ | |
import language.postfixOps | |
/** algebraic data type **/ | |
sealed trait ReconOp[A] | |
case object Delete extends ReconOp[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
import cats.syntax.option._ | |
import cats.instances.option._ | |
import cats.data.{Kleisli, Reader, ReaderT} | |
// this is the ADT for sub confs | |
sealed trait Confs | |
case class Sub1(n: String) extends Confs | |
case class Sub2(n: String) extends Confs | |
// this is the actual app class that fires up once everything is loaded |
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.~> | |
import cats.free._, Free._ | |
import cats.instances.option._ | |
// ADT | |
sealed trait Moves[A] | |
case class MoveUp[A: Numeric](pace: A) extends Moves[A] | |
case class MoveDown[A: Numeric](pace: A) extends Moves[A] | |
case class MoveRight[A: Numeric](pace: A) extends Moves[A] | |
case class MoveLeft[A: Numeric](pace: A) extends Moves[A] |
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 eu.timepit.refined._ | |
import eu.timepit.refined.string._ | |
import eu.timepit.refined.api._ | |
import io.circe.generic.auto._ | |
import io.circe.parser._ | |
import io.circe.syntax._ | |
import io.circe.refined._ | |
import Log._ | |
case class Log(auth: Auth0, version: Version) |
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.io.File | |
import akka.actor.ActorSystem | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.model.Multipart.BodyPart | |
import akka.http.scaladsl.model._ | |
import akka.http.scaladsl.server.Directives | |
import akka.stream.ActorMaterializer | |
import akka.stream.scaladsl.FileIO | |
import io.circe._ | |
import concurrent.duration._ |