Skip to content

Instantly share code, notes, and snippets.

@gotexis
gotexis / column-def.jsx
Last active June 20, 2023 08:57
Pasting excel / google sheet into editable table with mui-datagrid-pro
{
field: "fieldname",
width: 130,
editable: true,
renderEditCell: (params) => renderCell({ ...params, onPaste }),
}
@gvolpe
gvolpe / di-in-fp.md
Last active April 24, 2024 20:51
Dependency Injection in Functional Programming

Dependency Injection in Functional Programming

There exist several DI frameworks / libraries in the Scala ecosystem. But the more functional code you write the more you'll realize there's no need to use any of them.

A few of the most claimed benefits are the following:

  • Dependency Injection.
  • Life cycle management.
  • Dependency graph rewriting.
@ChristopherDavenport
ChristopherDavenport / StreamFirstChunk.scala
Last active July 20, 2020 08:37
Bubble Errors Up From First Segement
import cats.effect._
import cats.implicits._
import fs2._
object Reconstitute {
// Simplest method I can find at the current moment
def tryFetch1[F[_]: Sync, A](s: Stream[F, A]): F[Stream[F, A]] =
s.pull.uncons
.flatMap {
@StevenACoffman
StevenACoffman / fluent-filebeat-comparison.md
Last active April 2, 2024 22:34
Fluentd Fluent-bit FileBeat memory and cpu resources

Fluent-bit rocks

A short survey of log collection options and why you picked the wrong one. 😜

Who am I? Where am I from?

I'm Steve Coffman and I work at Ithaka. We do JStor (academic journals) and other stuff. How big is it?

Number what it means
101,332,633 unique visitors in 2017
@mpilquist
mpilquist / example.md
Last active May 17, 2021 13:17
Properly scheduling effect evaluation in FS2

TL;DR - Use fs2.time.sleep_[Task](delay) ++ Stream.eval(effect) instead of Stream.eval(effect.schedule(delay)).

FS2 never interrupts evaluation of an effect. This can lead to surprising behavior when using the schedule method on Task. Consider this test driver:

def testInterruption[A](effect: Stream[Task, A]): Stream[Task, A] = {
  val logStart = Stream.eval_(Task.delay(println("Started: " + System.currentTimeMillis)))
  val logFinished = Stream.eval_(Task.delay(println("Finished: " + System.currentTimeMillis)))
  val interruptSoonAfterStart =
 Stream.eval(async.signalOf[Task,Boolean](false)).flatMap { cancellationSignal =>

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@netzwerg
netzwerg / App.scala
Last active July 14, 2018 12:10
Parsing heterogeneous JSON with Circe
package ch.netzwerg
import cats.data.Xor
import io.circe._
import io.circe.generic.auto._
import io.circe.parser._
import org.scalajs.dom.document
import scala.scalajs.js