Random Link ¯\_(ツ)_/¯ | ||
Jun 22, 2024 | » | Testing in a Monorepo
7 min; updated Jun 22, 2024
Testing Web Components While any test framework can work, it’s better to test web components in a browser environment because that’s where they’ll be used. Node-based frameworks would require too much shimming of DOM calls that’d make the tests unrepresentative. and are good options for browser-based testing. is powered by ES-build, and so is the client-side of the app; let’s go down this path and see where it leads.... |
May 5, 2024 | » | Inheritance
2 min; updated May 5, 2024
Mixins Introduced to mixins by . Didn’t know that there are passionate advocates for this, e.g., ’s “You can even look at normal subclass inheritance as a degenerate form of mixin inheritance where the superclass is known at class definition time, and there’s only one application of it.” A mix-in is an abstract subclass. This technique is especially useful in languages where a class can only have a single superclass.... |
Apr 27, 2024 | » | Markup Features
4 min; updated Apr 27, 2024
Syntax Highlighting Previously, we’d highlight code on the client by loading src/lib/highlight.pack.js, a bundle downloaded from but served from our domain, and then execute hljs.highlightBlock on demand, e.g., on page load, when showing a card, etc. This doesn’t work well with a web-component-centric design. Running hljs.highlightBlock through possible Shadow DOM boundaries is a hassle. Back in 2018 , we installed highlightjs, a shim for the official HighlightJS.... |
Apr 19, 2024 | » | Client/Server Interface
8 min; updated Apr 19, 2024
How to handle redirects without setting window.location.href? Right now, there’s a pattern of doing: sendHTTPRequest("POST", "/login/", {}) .then((_) => { window.location.href = "/"; }) .catch((err) => { console.error(err); }); Isn’t this something that the server can do? In response, why not issue a redirect? Screenshot of the redirect chain from /login. The POST request gets a 303 (See Other) redirect to /home. The browser then makes a GET request to /home, which results in a 304 (Not Modified).... |
May 28, 2023 | » | Relational Model Versus Document Model
8 min; updated May 29, 2023
A relational data model uses tables that consist of rows and columns. A row can be uniquely identified by a table + ID combination. A column entry can reference another row in another table through a shared key. One goal is to avoid duplicating data. However, to answer a real-world query, we end up paying th cost by joining results from multiple tables. That said, with proper indexing and prior research, combining results is pretty fast.... |
Sep 28, 2021 | » | Observer
8 min; updated Feb 12, 2023
notes that , the primary source, glosses over nitty-gritties. e.g. the “message queue” server. Maybe reading through these will provide a larger perspective to design decisions made in Chromium regarding observers. Rant: some of willchan’s thoughts on WeakPtr, for those who care to read criticizes the observer pattern for murking dependency chains. Investigate more in this regard. Intent A one-to-many dependency between object so that when one object (subject) changes, all its dependents (observers) are notified and update automatically.... |
May 12, 2022 | » | Classes in C++
15 min; updated May 12, 2022
quotes Doug McIlroy: Those types are not “abstract”; they are as real as int and float. What is the context of this quote? A class is a user-defined type provided to represent a concept in the code of a program. Essentially, all language facilities beyond the fundamental types, operators, and statements exist to help define better class or to use them more conveniently.... |
Mar 16, 2022 | » | AoC 2021 Day 09: Smoke Basin
13 min; updated Mar 16, 2022
Multi-dimensional arrays using |
Feb 23, 2022 | » | AoC 2021 Day 03: Binary Diagnostic
14 min; updated Feb 23, 2022
Day 3 - Advent of Code 2021. adventofcode.com . Accessed Feb 23, 2022. Problem Description Part One The submarine has been making some odd creaking noises, so you ask it to produce a diagnostic report just in case. The diagnostic report (your puzzle input) consists of a list of binary numbers which, when decoded properly, can tell you many useful things about the conditions of the submarine.... |
Jan 15, 2022 | » | 020. Factorial Digit Sum
4 min; updated Jan 15, 2022
Problem Statement \(n!\) means \(n \times (n - 1) \times … \times 3 \times 2 \times 1\). For example, \(10! = 10 \times 9 \times … \times 3 \times 2 \times 1 = 3628800\), and the sum of the digits in the number \(10!\) is \(3 + 6 + 2 + 8 + 8 + 0 + 0 = 27\). Find the sum of the digits in the number \(100!... |