This is typescript environment setup guide for LLM and humans
Always setup baseline settings
- pnpm
- typescript
- vitest
| package akka.http.scaladsl | |
| import java.io.File | |
| import akka.http.scaladsl.unmarshalling.Unmarshal | |
| import akka.util.ByteString | |
| import scala.concurrent.duration._ | |
| import akka.actor.ActorSystem |
| package com.codetinkerhack | |
| import akka.actor.{ ActorRef, Props, Actor, ActorLogging } | |
| import akka.pattern.ask | |
| import akka.util.Timeout | |
| import scala.concurrent.duration._ | |
| import akka.actor.Actor.Receive | |
| import akka.pattern.pipe | |
| import scala.util.Success | |
| import scala.util.Failure |
| val buildFiles = SettingKey[Map[File, Seq[Byte]]]("build-files") | |
| buildFiles := getBuildFiles((baseDirectory in ThisBuild).value) | |
| def getBuildFiles(base: File) = | |
| ((base * "*.sbt") +++ ((base / "project") ** ("*.scala" | "*.sbt"))).get.map{ | |
| f => f -> collection.mutable.WrappedArray.make[Byte](Hash(f)) | |
| }.toMap | |
| def changed(base: File, files: Map[File, Seq[Byte]]): Boolean = |
"For comprehension" is a another syntaxe to use map, flatMap and withFilter (or filter) methods.
yield keyword is used to aggregate values in the resulting structure.
This composition can be used on any type implementing this methods, like List, Option, Try, Future...
| Number::pad = (digits, signed) -> | |
| s = Math.abs(@).toString() | |
| s = "0" + s while s.length < digits | |
| (if @ < 0 then "-" else (if signed then "+" else "")) + s | |
| Date.months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ] | |
| Date.weekdays = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ] | |
| Date.formats = | |
| "a": -> Date.weekdays[@getDay()].substring(0, 3) |