Skip to content

Instantly share code, notes, and snippets.

View bblfish's full-sized avatar

Henry Story bblfish

View GitHub Profile
@Swoorup
Swoorup / ActorK.scala
Last active July 17, 2023 19:54
Typed Actors using Cats Effect, FS2 and Deferred Magic
import cats.effect.syntax.all.*
import cats.syntax.all.*
import cats.effect.*
import fs2.Stream
import cats.effect.std.Queue
import scala.concurrent.duration.*
import lib.FSM
import lib.actor.{Actor, AskMsg}
@raychenon
raychenon / Slugify.kt
Last active January 11, 2022 06:26
Slug transforms a raw text (ex: title) into a pretty URL
import java.text.Normalizer
/**
* Extension function
*/
fun String.slugify(): String =
Normalizer
.normalize(this, Normalizer.Form.NFD)
.replace("[^\\w\\s-]".toRegex(), "") // Remove all non-word, non-space or non-dash characters
.replace('-', ' ') // Replace dashes with spaces