I hereby claim:
- I am guersam on github.
- I am guersam (https://keybase.io/guersam) on keybase.
- I have a public key ASCpi4lE8RcuK-hUUr5MFavzikvDnGPrPMjFfpumrW855go
To claim this, I am signing this object:
| #!/usr/bin/env bash | |
| # see https://forum.obsidian.md/t/gnome-desktop-installer/499 | |
| set -euo pipefail | |
| icon_url="https://cdn.discordapp.com/icons/686053708261228577/1361e62fed2fee55c7885103c864e2a8.png" | |
| #dl_url=${1:-} | |
| dl_url=$( curl -s https://api.github.com/repos/obsidianmd/obsidian-releases/releases/latest \ | |
| | grep "browser_download_url.*AppImage" | tail -n 1 | cut -d '"' -f 4 ) |
I hereby claim:
To claim this, I am signing this object:
http4s에서 어떻게 IO#unsafeRunSync 없이 JSON 응답을 반환할 수 있는지 문의가 들어와서 보충설명 드립니다:
슬라이드에서 잠깐 보여드렸던 것처럼 http4s 서버는 Request[F] => F[Response[F]] 형태의 순수 함수입니다. 미들웨어나 루트 합성을 위해 Kleisli나 OptionT같은 데이터 타입들이 추가로 쓰이기는 하지만 결국 Request에서 Response로 가는 순수 함수이고, 중간에 데이터베이스 연결 같은 이펙트가 발생할 수 있기 때문에 Request => Response 대신 Request => F[Response]와 같은 형태를 띄고 있다고 생각하시면 돼요. 아래같은 모듈이라고 생각하셔도 되겠네요.
trait HttpServer[F[_]] {
def handleRequest(req: Request): F[Response]
}| // Using new collection library in Scala 2.13 | |
| def nthColumnLabel(n: Int): String = | |
| Iterator | |
| .unfold(n) { | |
| case 0 => None | |
| case m => | |
| val m2 = m - 1 | |
| Some((m2 % 26 + 'A').toChar, m2 / 26) | |
| } | |
| .mkString |
| #!/usr/bin/env amm | |
| import $ivy.`org.typelevel::cats-core:1.4.0` | |
| import cats.implicits._ | |
| import java.net.{URLEncoder, URLDecoder} | |
| import scala.util.{Try, Success} | |
| val charsets = List("utf-8", "x-windows-949") |
| object KoreanJasoDecomposer { | |
| /** | |
| * 한글 음절 | |
| * | |
| * @param onset 초성 | |
| * @param nucleus 중성 | |
| * @param coda 종성 | |
| */ | |
| case class Syllable( |
| #!/usr/bin/env amm | |
| import $ivy.`com.github.gilbertw1::slack-scala-client:0.2.3` | |
| import slack.api.BlockingSlackApiClient | |
| import akka.actor.ActorSystem | |
| import scala.util.Try | |
| def sendSlackNotification(msg: String)(implicit sys: ActorSystem): Unit = { | |
| val token = "<token>" // TODO parameterize |
| import cats.data.{ EitherT, State } | |
| import cats.implicits._ | |
| import cats.{ Monad, ~> } | |
| import io.aecor.liberator.macros.free | |
| import io.aecor.liberator.syntax._ | |
| import io.aecor.liberator.{ ProductKK, Term } | |
| @free | |
| trait Api[F[_]] { | |
| def doThing(aThing: String, params: Map[String, String]): F[Either[String, String]] |
| import java.nio.charset.Charset | |
| import fs2.{Chunk, Pipe, Pull, Pure, Stream} | |
| object Fs2Util { | |
| val cp949Charset: Charset = Charset.forName("cp949") | |
| def cp949Decode[F[_]]: Pipe[F, Byte, String] = | |
| _.chunks.through(cp949DecodeC) |
| object Main { | |
| val xs = (1 to 10).toList | |
| def simple(): List[Int] = | |
| xs.map { i => | |
| i + 1 | |
| } | |
| } |