- Web Server: Play (framework) or http4s (library)
- Actors: akka
- Asynchronous Programming: monix (for tasks, reactors, observables, scheduler etc)
- Authentication: Silhouette
- Authorization: Deadbolt
- Command-line option parsing: case-app
- CSV Parsing: kantan.csv
- DB: doobie (for PostgreSQL)
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 teikametrics | |
| import scala.collection.SortedMap | |
| /** | |
| * Immutable implementation of an LRU cache. | |
| * | |
| * @author Twitter | |
| * | |
| * Copy pasted from the version previously in twitter-util v19.1.0 at |
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.effect.ExitCase._ | |
| import cats.effect.Sync | |
| import cats.effect.concurrent.Ref | |
| import cats.syntax.flatMap._ | |
| import cats.syntax.functor._ | |
| trait Tap[F[_]] { | |
| def apply[A](effect: F[A]): F[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
| val n = 9 | |
| val s = Math.sqrt(n).toInt | |
| type Board = IndexedSeq[IndexedSeq[Int]] | |
| def solve(board: Board, cell: Int = 0): Option[Board] = (cell%n, cell/n) match { | |
| case (r, `n`) => Some(board) | |
| case (r, c) if board(r)(c) > 0 => solve(board, cell + 1) | |
| case (r, c) => | |
| def guess(x: Int) = solve(board.updated(r, board(r).updated(c, x)), cell + 1) | |
| val used = board.indices.flatMap(i => Seq(board(r)(i), board(i)(c), board(s*(r/s) + i/s)(s*(c/s) + i%s))) |