Blog Articles - page 2
-
Cleanup Scala/Java project
Snippet for cleaning up a Scala project’s directory of all compiled files.
Read article → -
VSCode workplace recommended extensions
You can recommend the required VSCode extensions per repository to your fellow programmers. This is what VSCode calls “workspace recommended extensions”.
Read article → -
Unsafe Lazy Resource.scala
Snippet for an impure way (no IO) to create a resource that can later be closed.
Read article → -
Combining the terminal (iTerm) with the IDE
Read article →⌘+Click
on a file path triggers my terminal to open that file inside my IDE, and that helps a lot. -
Tolerance
I just refactored a piece of code. I deleted 6 source code files, and rebuilt the functionality with a bunch of dirty OOP classes shoved in a single file 😱
Read article → -
Atom/RSS Feeds are the Best Way to Consume the Web
I stay connected to websites I care about via an RSS/Atom feed reader. It’s better than social media for finding out what’s new because it’s clutter-free. By following RSS/Atom feeds, I discover wonderful gems that otherwise would be lost in the noise.
Read article → -
ING Scala Meetup on Scala 3 (live coding session)
Online meetup on Scala 3’s newly introduced types and features for encoding type classes.
Read article → -
Implementing a CountDownLatch (async and dirty)
Yo dawg, I heard you liked concurrency primitives. Let’s implement our own asynchronous, dirty CountDownLatch.
Read article → -
Matomo (Analytics) Hosting via Docker
Docker setup for self-hosting Matomo, an open-source alternative to Google Analytics.
Read article → -
Scala's List has a Secret
OOP couples the data with the methods operating on it, and this is considered bad in FP circles. But is it?
Read article → -
Tail Recursive Functions (in Scala)
Turning imperative algorithms to tail-recursive functions isn’t necessarily obvious. In this article (and video) I’m showing you the trick you need, and in doing so, we’ll discover the Zen of Functional Programming.
Read article → -
Snippet: Tagless Final vs OOP
Snippet of code discussing Tagless Final vs OOP-style dependency injection.
Read article → -
Snippet: Remove blank lines from text
Just a regular expression.
Read article → -
Execute shell commands in F#
Snippet in plain F# with no dependencies. Features a neat shebang.
Read article → -
Using ScalaTest for Effects
Helpers for integrating with
Read article →cats.effect.IO
. -
Best practice for natural Ordering
Definitions of
Read article →scala.math.Ordering
MUST BE consistent withequals
, an often overlooked law that can lead to problems. -
Managing Database Migrations in Scala
The database schema should be described as code, in your repository. And you should be able to semi-automatically update your database schema on new deployments.
Read article → -
List static blog tags in folder (Jekyll, etc)
Script for listing the used tags of a Jekyll directory of articles.
Read article → -
I like Option.get
We should strive to make illegal states unrepresentable.
Read article →Option.get
is a partial function that, according to many, shouldn’t be in the standard library. Yet it doesn’t bother me; the inability of Scala to make it safe is the problem. -
Organize and Index Your Screenshots (OCR) on macOS
Screenshots contain text, text that should be searchable, as finding a screenshot later is the whole point of creating it.
Read article → -
Block comments on the web
Comments on the web can be toxic, and a waste of time. Here’s how to block them…
Read article → -
Generic IOApp alternative
Read article →IOApp
alternative, for Cats Effect v2, that can work with any effect type. -
Effect Runtime
Defining a “runtime” for Cats-Effect v2 that provides the underlying environment necessary (i.e.
Read article →ContextShift
,Timer
,Clock
). -
When My World Vanishes
It’s me, facing a hard to solve problem. It’s a difficult one, and I’m having problems focusing. I make some coffee, I move to another room, and I’m already thinking of running to some coffee shop, forgetting that we’re still in a pandemic.
Read article → -
Scala Snippet: Unlawful Effects
Unlawful/independent version of
Read article →cats.effect.Effect
. -
Running integration tests, with Scala + sbt
Scala sbt setup for separating unit tests from integrationt tests.
Read article → -
Scala Snippet: Flow/Processor to Effect
Converts an Akka Streams
Read article →Flow
into anIn => IO[Out]
method, thus wrappingFlow
into Cats-Effect’sIO
. -
Privilege
Today it’s my 38ᵗʰ birthday. I was born into privilege. Other people aren’t as lucky.
Read article → -
Scala Snippet: Safe Passwords
For security, it’s not a good practice to keep sensitive data in RAM indefinitely.
Read article → -
Sample Error Hierarchy in Scala
Mimicking the HTTP error codes.
Read article → -
Snippet: turn on JVM debugging in sbt
Remote debugging can be used to debug externally executed programs, useful to activate in
Read article →sbt
in order to keep using it while debugging with your favorite IDE. -
TypeScript Sample: Flow Sensitive Typing
Demonstrating Typescript’s untagged union types.
Read article → -
Retry Failing Tasks with Cats and Scala
Retry actions ending in failure via simple functions and Typelevel Cats type-classes.
Read article → -
Scala Snippet: Cats-Effect Resource to Reactive Streams
Cats-Effect’s Resource can’t be converted directly into a Reactive Streams Publisher. Beware!
Read article → -
ExecutionContext Must Be Stack-safe
Sample demonstrating that directly executing runnables in your
Read article →ExecutionContext
(with no stack-safety) is a really bad idea. -
Fatal Warnings and Linting in Scala
Strengthen your code via
Read article →-Xfatal-warnings
, linting and piss off your colleagues with useful compiler errors. -
Parallelizing Work via a JavaScript Semaphore
Simple and very effective implementation of a Semaphore, used for easily parallelizing work in JavaScript/TypeScript.
Read article → -
Blog Updates
Dusted off my website, with big plans ahead.
Read article → -
Python Snippet: Send Email via SMTP
Python snippet for sending an email via SMTP.
Read article → -
Shell Snippet: Encrypt Files with AES256
Quickly encrypt a message or a file for sending to your colleagues over unsecure messengers (Slack, etc).
Read article → -
Haskell Snippet: Sierpinski Triangle
A fun Haskell sample that draws a Sierpinski triangle via ASCII characters.
Read article → -
Regexp Replacement via Function in Java/Scala
Replace in strings via regexp, with the replacement being calculated via a function.
Read article → -
Async Queue in TypeScript
Production-ready, Promise-enabled async queue.
Read article → -
Scala Snippet: Blocking Task
Monix Task implementation for wrapping (suspending) blocking I/O such that it can be canceled. s Imported from gist.github.com.
Read article → -
Scala's isInstanceOf is an Anti-Pattern
Scala has a much better way of discriminating between types. Scala has implicit parameters, with which you can describe type classes.
Read article → -
On Bifunctor IO and Java's Checked Exceptions
Bifunctor IO is a hot topic in the Scala community. Herein I’m expressing my dislike for it, as it shares the problems of Java’s Checked Exceptions.
Read article → -
In Defense of OOFP
OOP versus Type Classes, exemplified and in defense of the Scala collections redesign.
Read article → -
Minitest: Zero Crap Scala Testing Library
Minitest is my minimal testing library that I’ve been using for developing Monix.
Read article → -
What is Functional Programming?
FP is programming with (mathematical) functions, there’s no room for interpretation.
Read article → -
Scala Days 2017 — Monix Task
My presentation from Scala Days 2017, Chicago (April) and Copenhagen (June), on the design of Monix’s Task.
Read article →