Skip to content

Instantly share code, notes, and snippets.

@kubukoz
kubukoz / main.scala
Last active October 1, 2025 14:43
http4s + scalatags + htmx + fs2/SSE
//> using scala 3.7
//> using dep org.http4s::http4s-ember-server:0.23.30
//> using dep org.http4s::http4s-dsl:0.23.30
//> using dep org.http4s::http4s-scalatags::0.25.2
//> using option -Wunused:all
import scalatags.Text.all.*
import cats.effect.*
import fs2.Stream
import org.http4s.*
import org.http4s.dsl.io.*
@debasishg
debasishg / dod.md
Last active October 16, 2025 05:41
Data oriented design, hardware awareness, cache awareness in data structures & algorithms

Performance Engineering, Hardware and cache awareness with algorithm and data structures

  1. Parallel Computing Course - Stanford CS149, Fall 2023
  2. Performance-Aware Programming Series by Casey Muratori
  3. Algorithms for Modern Hardware
  4. Computer Systems: A Programmer's Perspective, 3/E - by Randal E. Bryant and David R. O'Hallaron, Carnegie Mellon University
  5. Performance Engineering Of Software Systems - am MITOCW course
  6. Parallel Programming 2020 by NHR@FAU
  7. Cpu Caches and Why You Care - by Scott Meyers
  8. [Optimizing a ring buffer for throughput](https://rig
@dacr
dacr / tapir-zio-dynamic-api.sc
Last active May 25, 2024 08:39
An API to rule them all - to define or customize new API at runtime / published by https://github.com/dacr/code-examples-manager #dbccfc26-c532-4aa9-b3cd-eb13cbaa5370/c2f6303cd7dc5719bb533664fce41e5f60fbc5db
// summary : An API to rule them all - to define or customize new API at runtime
// keywords : scala, zio, tapir, http, zhttp, stateful, state, @testable, @exclusive
// publish : gist
// authors : David Crosson
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2)
// id : dbccfc26-c532-4aa9-b3cd-eb13cbaa5370
// created-on : 2023-12-08T18:45:32+01:00
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
// test-with : curl -L http://127.0.0.1:8080/hello/david
@carlosedp
carlosedp / Readme.md
Last active May 3, 2023 19:13
Find plugin updates for Scala cli, mill build tool and ammonite scripts

This is a Scala script to check for Mill build plugin and scala-cli lib updates. The plugin requires scala-cli.

Run directly from the gist with:

scala-cli https://gist.github.com/carlosedp/c3ea2814ac5392051a562e95c1298239/raw/checkdeps.sc

Or download the script, make it executable and run as:

What follows are some of my (very) rough thoughts on what we can and should do with respect to CPS transformation in Scala at the language level. I'll try to start with some motivation behind my thinking, as well as some rambling observations on the nature of the problem space, but don't expect too much coherence here. :-)

The Problem

Async programming is hard.

Okay let's actually be more specific than that. High-performance I/O is hard. Signal multiplexing is a powerful technique for achieving high(er) performance I/O, particularly network I/O, but the tradeoff is that, in order to utilize it, the user-space programming model must allow for suspension and resumption of sequential continuations (often called "fibers" or "coroutines"). Achieving this type of programming model without significant tradeoffs in usability is what is exceptionally hard.

If that wasn't bad enough though, these problems are inextricably conflated with another set of problem spaces which are, themselves, very difficult. In

@julien-truffaut
julien-truffaut / Monocle3.MD
Last active July 7, 2022 09:31
Monocle 3.x

We recently started the development of the next major version of Monocle, Monocle 3.x. In this post, I would like to explain our objectives and discuss some of the changes we intend to make.

Monocle 3.x will be a complete rewrite. It doesn't mean we will change everything, but we will question every aspect of the library: optics encoding, API, names, dependencies, etc. We defined the following objectives to help us make trade-offs in the new design:

  1. User-friendly interface. A user should be able to perform the most common actions without requiring in-depth knowledge of optics.
  2. Correctness. Optics follow certain essential principles. Those rules may not be intuitive, but without them, optics would not be a useful abstraction. The API should make it easy to follow those principles and avoid any undesired behaviours.
  3. Focus on Scala 3. We should design the API and include features such as they are suitable for Scala 3.
  4. Performance. Optics are slower than handwritten equivalent code
@dacr
dacr / index.md
Last active May 11, 2025 11:26
David's programming examples knowledge base / published by https://github.com/dacr/code-examples-manager #fecafeca-feca-feca-feca-fecafecafeca/6e82bf2949cc61c919535ce35a58ebc93721c33

David's programming examples knowledge base

akka-pekko

@abeln
abeln / scala-explicit-nulls.md
Last active December 18, 2020 13:57
Scala with Explicit Nulls
@fbaierl
fbaierl / Format
Created October 25, 2018 07:59
Scala.js string interpolation like java.text.MessageFormat
object Format {
/**
* String interpolation [[java.text.MessageFormat]] style:
* {{{
* format("{1} {0}", "world", "hello") // result: "hello world"
* format("{0} + {1} = {2}", 1, 2, "three") // result: "1 + 2 = three"
* format("{0} + {0} = {0}", 0) // throws MissingFormatArgumentException
* }}}
* @return