Hung-Yi’s Journal

Front-end Developer, Emacs Adventurer, Home Cook

11 Oct 2020

A Function to Get Org-Mode Contents Under a Heading

Today I'm sharing an interactive function I wrote as an exercise to extract just the inner text content of an Org-mode subtree, excluding the heading itself and any subheadings or their contents. The function adds it to the kill-ring (a.k.a. copies it to the clipboard) and returns it, but can easily be modified to do anything to the contents.

06 Oct 2020

Tearing Off Windows in Emacs

Do you often yourself referring to something in Emacs over and over again, but actually doing work somewhere else? For instance: referring to API code while writing front-end code, or referring to a file while entering commands into a shell? Let's go through the ways I would normally handle this and why I think the tear-off-window command can help.

04 Oct 2020

A More Ergonomic Keybinding for Flycheck in Doom Emacs

I rely on flycheck a lot for giving me hints on type errors when I'm writing TypeScript, but in Doom Emacs the flycheck commands are still bound to C-c !. Since I don't have flycheck configured to run 'live' on every code change (for performance reasons) I found myself pressing C-c ! c manually all the time, which became physically painful. But I think I've found a good rebinding that stays in line with the Doom way of doing things.

28 Sep 2020

JavaScript's Reduce: A Swiss Army Knife for Arrays

There's a little Array method in JavaScript that I've seen a lot of developers overlook. I suspect it's because of its abstract nature that doesn't exactly lead developers to any obvious use cases. But that's why I think it's a great programming Swiss Army knife: you can do a lot more with it than you might realise1. Let me introduce you to my friend, Array.prototype.reduce(). Today, I'll show you some creative ways to use it that may just inspire you.

22 Sep 2020

Why I Use ReactiveX and RxJS in Angular

It's been more than 5 years since I started writing my UI code in a reactive fashion with ReactiveX. I've used RxJava for Android development, ReactiveUI for Xamarin development, and now I'm using RxJS for Angular development. I stuck with it not because it was easy—it definitely wasn't—but because something about it just felt so right. For the longest time I couldn't explain it, and I'm not even sure I can explain it succinctly now. But today I want to use an example to at least try to illustrate just a touch of the mystery and allure that drew me into Reactive1 Programming in the first place. Let's dive in.