1. I just finished watching the latest episode of Pointfree. What they are working towards is nothing short of impressive, especially considering how little code it involves. Making an interactive onboarding tutorial using the same view code wouldn’t be possible without this level of encapsulation.

  2. There is something about pull requests like this that leaves me with a warm, fuzzy feeling that’s quite hard to capture in words. Knowing that there are people out there who care about details as much as you do and who actively seek to make whatever they come across better is truly motivating. Thanks @dkhamsing for making my day!

  3. The new site design is live! 🎉 This time around I focused on rethinking the landing page and expanding the light appearance to cover the entire site, not just the content area. For the light color palette, I drew some inspiration from the earliest iterations of the site, circa 2009.

    Other changes include a new portfolio page, pagination in the microblog, and moving This Week I Learned to the main blog.

  4. Starting next week I will be helping Hyper Island students take their first step into the world of HTML, CSS, and JavaScript. I am pretty excited about this opportunity to share my passion for the Web, and I hope that by introducing them to the basic building blocks I can help them see the forest for the trees.

  5. I am quite tempted to use the new @AppStorage and @SceneStorage in SwiftUI, but the hefty price to pay on the debugging and testing front is giving me pause.

  6. This Week I Learned #20

    Here are some of the things I learned this week, in the order I’ve noted them down.

    # Programming

    • How to use mdx and mdx-deck to create interactive slide decks. It’s essentially a mashup of Markdown and React that generates highly customizable HTML slides that can be deployed as is or exported as a PDF document. I usually scuff at the idea of using Web-based presenttion tools, but this stack lends itself particularly well for the Web-dev related material I am currently working on.
    • I never paid close attention to how bitwise operations and bit shifting exactly work, but this article by Donny Wals prompted me to stop procrastinating and go over the official Swift guide on the topic.
    • I managed to use the new redacted(reason:) modifier in SwiftUI and remove the custom view I used for the purpose of displaying placeholders while the content loads. Happy to see utility APIs like these make their way to the framework.
  7. People picking a side in these public feuds between mega corporations aren’t thinking straight. They are doing it for their bottom line—what are you doing it for?

  8. This Week I Learned #19

    Here are some of the things I learned this week, in the order I’ve noted them down.

    • Esprit de l’escalier, “the staircase spirit”, is a French expression used in English to describe the frequent occurrence of coming up with the perfect reply only after leaving the premises of the argument or debate.

    # Programming

    • What connection pooling means in the context of server-side applications and how it’s implemented and used in various Swift frameworks (link).
    • Orthogonality in programming refers to the ability to use a limited set of constructs in a limited number of combinations, where changing one part doesn’t affect the others (via this article).
    • Speaking of orthogonality, or extreme lack thereof, the Web front-end ecosystem is as fragmented, poorly documented, and messy as ever. With every new wave of build tools, frameworks, and dependency managers comes an additional layer of compatibility issues and gotchas. Sometimes writing few extra lines of code for one less dependency isn’t all that bad.
  9. As I started work on the next iteration of the site, I realized that I need to reconsider certain content-related aspects. For instance, I have been exclusively using this microblog for the past year or so, all but abandoning the main blog. One obvious change I could begin with is moving This Week I Learned entries over to the blog or even splitting them into their own thing altogether.

  10. This Week I Learned #18

    Here are some of the things I learned this week, in the order I’ve noted them down.

    • Polybius is an urban legend from the early 2000s around an arcade game experiment that was allegedly run in the 80s by the US government in Portland, Oregon. According to the legend, the game was extremly addictive and caused several psychoactive effect on the players. Shortly after its supposed release, it is said that all Polybius arcade machines have disappeared without a trace.1
    • The Zeigarnik Effect refers to people’s tendency to remember incomplete tasks better than successful ones (via Laws of UX). No wonder I have a constant sense of guilt over my abandoned side projects.

    # Programming

    • Writing both the client-side app and the server-side API in Swift has some pretty significant benefits. In addition to sharing a lot of business logic, this approach reduces the impact of context switching when developing a new end-to-end feature. Writing the entire stack in the same language, using the same IDE, in the same workspace is a godsend.

    1. Most of this sounds ludicrous, but it never hurts to indulge in an urban legend or two, especially if it involves video games.

  11. This Week I Learned #17

    Here are some of the things I learned this week, in the order I’ve noted them down.

    • The coastline paradox refers to the phenomenon where the fractal nature of coastlines causes their length estimates to vary widely depending on the scale of the ruler used. This length tends towards infinity as the measurement unit gets smaller and smaller, going against the logical expectation when measuring a finite distance (via Marc Edwards).
    • The proportionality bias refers to our tendency to assume that major events have major causes. While it’s often cited as a likely reason people believe in conspiracy theories, it’s also why programmers spend hours debugging a problem, probing every nook and cranny, only to find out that the cause is much more trivial than what was anticipated.

    # Design

    • In 3D graphics software, namely Blender, a shadow catcher is a completely transparent material that “catches” and renders the shadows of other objects in the scene—useful when exporting 3D renders for further 2D composition and editing. When using the Cycles renderer in Blender, this is as easy as ticking a checkbox. In EEVEE, Blender 2.8’s new rendering engine, it requires using a custom shader to obtain a similar effect.

    # Programming

    • I went trough the first half of the Tour of Rust guide with the intention of getting more familiar with its syntax and memory management APIs. Beside the relationship between ownership and mutability, many of the concepts introduced in what I’ve seen so far felt quite similar to their Swift counterparts.
  12. I enjoyed Chris Krycho’s take on the idea, but I totally understand where he is coming from. Like any other commitment, it takes time and energy that might not always be readily available.

    After four months of running this experiment, I am starting to feel the pressure. Some weeks go by where I don’t learn much worth mentioning, or simply don’t have enough time to elaborate. But I remain convinced this is a habit I’d like to keep—if anything, it helps me rebuild confidence in my ability to follow through commitments of this kind.

  13. This Week I Learned #16

    Here are some of the things I learned this week, in the order I’ve noted them down.

    • This week I picked up aws-sdk-swift with the goal of integrating with SES, Amazon’s cloud email service. After some initial struggle figuring out which API version to use and how, I managed to send emails from a server-side Swift app I am currently working on.
    • Some valuable lessons about S3, AWS billing, and CDNs by Chris Short (link).
    • SwiftUI’s new Menu component is now available on iOS 14 as of Beta 3. I suspect contextual menus to gain more traction on iOS and I am happy to see them join a growing list of SwiftUI components.
  14. This Week I Learned #15

    Here are some of the things I learned this week, in the order I’ve noted them down.

    • Understanding any topic in greater depth requires honesty, integrity, and patience. Thinking hard about the problem space and seeking first-hand experience also yields far deeper understanding than contenting oneself with the syntheses of others (link).
    • Beta invites to OpenAI’s API, powered by the new GPT-3 (paper), are starting to go out and some of the demos are generating a lot of buzz at the moment. This was the article that brought my attention to this.

    # Programming

    • How to properly use services in Vapor 4. I am still not fond of the amount of work involved, but it’s an effective way to extend the built-in capabilities of the default types.
    • How to use HTMLElement to build a custom DOM element that encapsulates structure, styling, and interactions (link).
    • How the isSource and properties arguments in SwiftUI’s matchedGeometryEffect work (link).
  15. On flatMapThrowing in SwiftNIO

    Johannes Weiss answering the question why flatMapThrowing (docs) is not a throwing flatMap:

    Functions that have this prototype: f() throws -> EventLoopFuture<Void> are in my view a bit user hostile. They can fail in two different ways: by throwing [and] by returning a failed future. That means a user needs to look for errors in two different places. […] On top of that: If an asynchronous function throws synchronously, is it really asynchronous?

    This one caught me off-guard more than once. Considering the signatures of map and flatmap (abridged for brevity):

    func map<NewValue>(callback: @escaping (Value) -> NewValue) -> EventLoopFuture<NewValue>
    func flatMap<NewValue>(callback: @escaping (Value) -> EventLoopFuture<NewValue>) -> EventLoopFuture<NewValue>

    It’s easy to assume that flatMapThrowing is a version of flatMap that takes a throwing closure of type (Value) throws -> EventLoopFuture<NewValue>. But that’s not the case.

    func flatMapThrowing<NewValue>(callback: @escaping (Value) throws -> NewValue) -> EventLoopFuture<NewValue>

    As for the name of the method, Johanness explains:

    Lots of people get confused by this, if I could choose again, I’d probably go for something like combineThrowing or so?

  16. How come “a11y”, the widely used numeronym of the word accessibility, is itself not accessible?

    Saving key strokes at the expense of readability is the antithesis of what accessibility stands for, in my opinion.

  17. This Week I Learned #14

    Here are some of the things I learned this week, in the order I’ve noted them down.

    • Lambertian surfaces and their photometric properties, through this stunning interactive guide by Bartosz Ciechanowski.1
    • I learnt quite a bit from this exploratory piece by Mattt about how core concepts from the Semantic Web can be used to make the code we write semantically richer, unlocking new authoring, distribution, and reuse possibilities in the process.

    # Programming

    • How the new matchGeometryEffect works in SwiftUI. This new API enables synchronizing view animations and transitions regardless of their place in the hierarchy. It’s quite powerful and will make some previously labor-intensive effects much easier to achieve (link 1, link 2).

    1. If you had asked me ten years ago about how Wikipedia or Wolfram Alpha would look in 2020, I’d have pictured something along the lines of Bartosz’s work. Yet, we’re absolutely nowhere near that. One can’t help but wonder if we have been focusing on the right things all these years.

  18. On Static Site Generators

    Peter Zignego writes about his experience with Swift static site generators:

    After a bit of spelunking, I realized that it had been built with some beta version of Xcode long since lost to the sands of time — I was stuck with a binary I couldn’t run.

    Luckily most of this is behind us now. Prior to 4.0, this was a major drawback of using the language for general purpose programming.

    Over the course of the week I spent converting this site to use Publish, I was frustrated by a lot of the built-in assumptions and general inflexibility. While I am sure that it is a great Swift by Sundell generator, it is not (yet) a great general-purpose static site generator.

    As a Website maintainer, finding a static site generator that works exactly the way you want is no small feat. I used a handful in the past 10 years, across personal and client projects, and I still haven’t found the one. Plugins and extensions do help, but there will always be a set of assumptions that are not true for every project.

    But the beauty of open source is exactly that, so I forked it and fixed my two biggest issues.

    If you’re going to use a static site generator, use one written in a language you are comfortable with. Sooner or later, you’ll find yourself in a position where you need to patch the build system to add new functionality or modify existing one, especially if you are making Websites for a living.

    In practice I found [using an HTML DSL] to be more clunky and mistake-prone than just writing HTML with Mustache templates, which is what I was converting from.

    Couldn’t agree more as someone who always preferred templating languages (Mustache, Liquid, etc) to DSLs. The latter often introduce friction that seems unnecessary if you are already comfortable with HTML and CSS.

    I‘m not head over heels in love with Gatsby, but it’s versatile and battle-tested. I‘ll eventually look into migrating to a Swift build system, but I can’t afford the time to do so for the time being.

  19. This Week I Learned #13

    Here are some of the things I learned this week, in the order I’ve noted them down.

    • I am a bit late to the r/covidcookery party, but this weekend I baked my first cake ever! An okay-looking, totally edible pound cake. There’s definitely a lot of room for improvement, but the sense of achievement when I took it out of the oven and it wasn’t a complete mess is quite the feeling. Thanks Alaa for the hands-on tips!
    • It took quaternions 150 years after their discovery by Williams Rowan Hamilton to find practical uses such as 3D computer graphics and robotics. Immediate applicability is never the primary goal of mathematical research (article via Hacker News).
    • Gemini is a budding client-server protocol aiming to offer a bloat-free alternative to the HTTP Web. It uses a Markdown-inspired document format and completely forgoes client-side scripting and styling (source).
    • I saw a PC ad on Japanese TV that ended with the Intel Inside slogan:「インテル入ってる」(interu-haitteru). Pretty clever for a marketing localization, right? Well, as it turns out, the perfectly-rhyming Japanese slogan came first (!) and served as inspiration for the English version, according to Susumu Furukawa, the president of Microsoft Japan between 1986 and 1992 (source).

    # Programming

    • I totally missed this initially, but it’s possible starting iOS 14 to customize the navigation bar title in SwiftUI (link).
  20. This Week I Learned #12

    All of the notes I’ve taken this week are related to WWDC 2020, Apple’s annual developer conference.