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 mf.examples | |
| import scala.concurrent.Future | |
| import scala.concurrent.ExecutionContext | |
| import scala.util.Try | |
| import cats._ | |
| import cats.data._ | |
| import cats.implicits._ | |
| case class Request(value: 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
| ;;; .doom.d/config.el -*- lexical-binding: t; -*- | |
| ;; Place your private configuration here | |
| (setq doom-font (font-spec :family "Hasklig" :size 14)) | |
| (when (version<= "26.0.50" emacs-version ) | |
| (global-display-line-numbers-mode)) | |
| ;; |
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 monix.eval.Task | |
| import monix.execution.Scheduler.Implicits.global | |
| import monix.reactive._ | |
| import scala.concurrent._ | |
| import scala.concurrent.duration._ | |
| // possibly useful | |
| // https://github.com/monix/monix/issues/481 | |
| // https://stackoverflow.com/questions/45894205/getting-cassandra-query-results-asynchronously-using-scala-monix |
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
| // the type I take in which isn't that useful | |
| case class AuthorizeRequest( | |
| code: Option[String], | |
| token: Option[String], | |
| secret: Option[String], | |
| verifier: Option[String], | |
| redirectUri: String, | |
| clientId: String, | |
| clientSecret: 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
| // a NoOpLogger of zio-logging for a logging effect | |
| trait NoOpLogger extends Logging[String] { | |
| def logging: Logging.Service[Any, String] = new Logging.Service[Any, String] { | |
| override def trace(message: => String): ZIO[Any, Nothing, Unit] = ZIO.unit | |
| override def debug(message: => String): ZIO[Any, Nothing, Unit] = ZIO.unit | |
| override def info(message: => String): ZIO[Any, Nothing, Unit] = ZIO.unit | |
| override def warning(message: => String): ZIO[Any, Nothing, Unit] = ZIO.unit |
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
| avgForClient :: Purchase -> Double | |
| avgForClient (Purchase _ products) = | |
| let n = fromIntegral $ DT.length products | |
| totals = sum $ price <$> products | |
| in totals / n | |
| -- outputs nullnullnullnull... unless the json is on a single line. | |
| -- how to make this work for multi-line json? | |
| main :: IO () |
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
| module Scratch where | |
| data Shape = Circle { radius :: Int } | |
| | Rectangle {length :: Int, width :: Int} | |
| | Triangle {length :: Int, height :: Int} | |
| deriving (Show, Eq) | |
| -- how would you fromJSON shape assuming there |
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
| (map! :map scala-mode-map | |
| "C-c C-t" #'lsp-ui-doc-show ;; shows type under cursor as a hover | |
| "C-c t" #'lsp-describe-thing-at-point ;; shows type under cursor in temp buffer below | |
| "C-c H" #'lsp-ui-doc-mode ;; toggle auto-showing type under cursor asa hover | |
| "C-c F" #'lsp-format-buffer ;; run scalafmt on the entire buffer | |
| "C-c f" #'lsp-format-region ;; run scalafmt on the selected region | |
| "C-c C-f" #'lsp-find-references ;; find references symbol under cursor | |
| "C-c i" #'lsp-execute-code-action ;; import missing type/class | |
| "C-c r" #'lsp-rename ;; rename symbol | |
| "C-c e" #'lsp-ui-flycheck-list ;; list all errors |
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
| ##### Crawl Init file ############################################### | |
| # For descriptions of all options, as well as some more in-depth information | |
| # on setting them, consult the file | |
| # options_guide.txt | |
| # in your /docs directory. If you can't find it, the file is also available | |
| # online at: | |
| # https://github.com/crawl/crawl/blob/master/crawl-ref/docs/options_guide.txt | |
| # | |
| # Crawl uses the first file of the following list as its option file: | |
| # * init.txt in the -rcdir directory (if specified) |
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
| trait Statsd[F[_]] { | |
| def inc(key: String, magnitude: Int = 1, sampleRate: Double = 1.0): F[Unit] | |
| def dec(key: String, magnitude: Int = 1, sampleRate: Double = 1.0): F[Unit] | |
| def gauge(key: String, magnitude: Double, sampleRate: Double = 1.0): F[Unit] | |
| def timer(key: String, value: Int, sampleRate: Double = 1.0): F[Unit] | |
| } | |
| // the legacy client takes in a fixed thread pool of 1. Under the hood it does some | |
| // websocket / NIO stuff | |
| // am I wrong to contextShift onto the same thread pool that it's using? |