Defining a Kotlin DSL for building nested hierarchies

One of the Kotlin programming language’s strengths is the ability to easily define a language for a specific use case, or a domain-specific language (DSL). In this post, I will showcase how we can define a domain-specific language to create objects with nested hierarchies. Imagine that we have a list of authors and each author can have more than one book and each book consists of several chapters: data class Author( val id: String, val firstName: String, val lastName: String, val books: List<Book> ) data class Book( val id: String, val title: String, val chapters: List<Chapter> ) data class Chapter( val id: String, val number: Int, val title: String ) The goal of this post is to be able to easily create these objects and only provide the information that is available and have defaults for the information that is not....

April 8, 2023 · 5 min · Danilo Herrera

Tracking Jira tickets with Dendron

Dendron is an open source knowledge management tool that I have incorporated into my personal and professional life to capture knowledge, write journals, maintain to-do lists, etc. In this post, I describe one aspect of Dendron that I find particularly useful: leveraging the power of templates to automate the creation of checklists. Background Dendron is a VS Code extension and therefore all interaction is performed via VS Code. A Dendron project is called a vault....

September 21, 2022 · 4 min · Danilo Herrera

Configuring Autoreload for Ktor

In this post, we’ll be going over how to create a basic Ktor project and configuring it with autoreload, a feature that automatically rebuilds the code on file changes. Furthermore, we’ll explore two ways of building and running the application: via the command line and via the IDE. Creating a Ktor project Using the latest version of IntelliJ IDEA, ensure the latest Ktor plugin is installed. This plugin provides us with a convenient user interface to generate new Ktor projects....

June 23, 2020 · 4 min · Danilo Herrera

An Introduction to Tracking Transactions with Ledger CLI

Introduction Ledger CLI is an open source command line accounting tool used for calculating reports from a ledger (a file containing a list of transactions for different accounts). With Ledger CLI you are able to view a register (a list of transactions), balance of accounts, budget report, etc. In this post, I’ll be going over defining a basic ledger and calculating balance and register reports. Prerequisites Essential Ledger CLI Optional VS Code I know: a text editor for a command line tool?...

December 14, 2019 · 7 min · Danilo Herrera

Reference: Signing Commits with GPG

Creating a GPG Key Create a key with gpg --gen-key and input your name, email address, and passphrase when prompted. For more options, use gpg --full-generate-key. To view secret keys: gpg --list-secret-keys or gpg -K To export secret keys: gpg --export-secret-keys $ID > private-key.asc To export public key for sharing: gpg --armor --export $ID > public-key.asc or gpg --armor --export $EMAIL > public-key.asc Using the GPG Key with Git In your git repo:...

June 19, 2019 · 1 min · Danilo Herrera

Setting up a Ghost blog on a VPS with Docker

What better way to start out a tech blog than by writing out my process on how I set the blog up? By day, I am an Android developer, so this was a bit out of my comfort zone. Although I have set up a few Wordpress blogs, this was several years ago (pre-Docker), and I was never fond of the amount of effort required to make the aesthetics decent. Ghost looks nice out of the box, and they offer a (limited) selection of free themes....

January 30, 2019 · 3 min · Danilo Herrera