Skip to main content

Posts

Batding

Recent posts

JavaScript: Calculate Duration Since

Hope you're well. 🎩 I find YouTube's date-trimming on video thumbnails rather amusing. I did it back then with my close-enough vibe. But recently, when I compared it to actual YouTube frontend, hm... 🤔 That's different. Nifty, that. Analysis As I've observed, the pattern goes like this: 0 day = 0 day. 1 day = 1 day. 2 days = 2 days. ... 6 days = 1 week. 7 days = 1 week. 8 days = 1 week. 9 days = 1 week. ... 12 days = 2 weeks. 13 days = 2 weeks. 14 days = 2 weeks. ... 1 month, 2 weeks, X days = 2 months. ⬆️ See the pattern? The trimming logic goes as such: Let: Y = years M = months W = weeks D = days and M_max = 12 (months per year) W_max = 4 (weeks per month, approximated) D_max = 7 (days per week) Then the rounding rule: if D ≥ ½·D_max ➡️ W = W + 1, D = 0 if W ≥ ½·W_max ➡️ M = M + 1, W = 0 if M ≥ ½·M_max ➡️ Y = Y + 1, M = 0 Hence the result is: ceil(Y, M, W, D) ⬆️ Increment the larger unit whenever ...

Ouija

This board. Ouija, they pronounce it as WEE-juh . 🤔🤷 But to me, that's clearly two words combined: oui + ja = ouija . Now why were they combined? That's comical. Oui = yes. It's a French word. A bit like how English pronounces "we". Sometimes, "way". For instance in French telly, Oui, alors... ⬅️ that would sound, that. Ja = yes. A Germanic word. Usually, pronounced as "ya". We-ya. Like that Bruce-Lee yell. It's specifically Bruce Lee. Mike Tyson perhaps did it, but not recorded. Please Enable JavaScript. 👄 Ouija pronunciation. (Bruce facepalms.) If we utter each with proper pronunciation, "ouija" will sound like a confused French in a Bavarian tavern with a Cockney barman. (Barman.) Two quid, please. (Ouija bloke.) Oui... Ja! (Barman.) 🤨 Oi, guv. Two quid. (Ouija bloke.) Deux? NEIN! 🍺 Ouijahahahaha! 🏃‍♀️‍➡️🏃‍♀️‍➡️🏃‍♀️‍➡️ (Barman.) 👀 Blimey!...

JavaScript: The replaceChildren()

Good day. 🎩 In JavaScript, when we want to empty or replace the content of a container element, we usually do this: // 1. Empty the container. container.innerHTML = ""; // 2. Replace the content. container.innerHTML = "the replacement"; Now, we have replaceChildren() — documentation on MDN . It was added mid-2020, part of the DOM Living Standard, first implemented in browsers between mid and late 2020 (around the ECMAScript 2020 timeframe, though technically not an ES feature). ES = ECMAScript, not Espagnol. Usage // 1. Empty the container. container.replaceChildren(); // 2. Replace with a single node. container.replaceChildren(newNode); // 3. Replace with multiple nodes. container.replaceChildren(newNode, otherNewNode); // 4. You can even pass strings — they'll be converted to text nodes. container.replaceChildren("Humphry Davy approves this example!"); newNode and otherNewNode are variables. For instance: const newNode = docum...

Orcs

This specimen ⬇️ ⬆️ That orc. Please Enable JavaScript. The modern concept of the orc in entertainment originates largely from J.R.R. Tolkien , who popularised them in The Lord of the Rings as brutish, corrupted creatures bred for war by dark powers. Though inspired by earlier mythological beings such as goblins, ogres, and various demonic entities from European folklore, Tolkien gave orcs a distinct identity — organised, militaristic, and inherently malicious. His influence shaped fantasy literature, tabletop games like Dungeons & Dragons , and video games, where orcs are now a staple enemy race, often portrayed with green skin, muscular builds, and a tribal warrior culture. Over time, variations have emerged, but most still trace back to Tolkien's original wartime allegory. Brutish. 🤔 If they were British, composed creatures bred by tea and honour, I postulate they would go like: Biscuits? What a splendid day, this is. And they don...

Chess: Englund Gambit: Hartlaub-Charlick Line

In this 3 minutes blitz game, I played as the defence side. This isn't a high Elo game, obviously. 1600–1700ish max, but in sheer entertainment? 3000+ 🤣 We have inaccuracies, mistakes, and blunders crayon-coloured all over the board. You can use your left and right arrows on your keyboard or use the mouse scroll to see the moves back and forth on the chessboard. But first, click the board. Proper Street Hawk Chess. Englund Gambit The motto is What if I give you free material from the very beginning? Englund is taken from Fritz Carl Anton Englund (1871–1933), a Swedish chess player and writer. Do you know "Dancing Queen" by ABBA? Indeed. He wasn't a world champion, but more of an enthusiast with a love for offbeat openings and aggressive lines. "Dancing Queen" is a song, not a male. But I'm amused by my own typing. Imagine if it were taken from "England". Well, it would be like someone took London System an...

YouTube Is Back

Did you realise YouTube was... having issues? They perhaps then: git revert redesign-nightmare You see, James the QA was off jiving to Alizée's songs. Lead : JAMES! Did you test the new layout across all CDN clusters!? James: : (Taking off headphones.) Huh? What layout? Wait… we're deploying today? Blimey… C'est pas ma faute… Lead : You... 🤦 Fine... Revert back, lads! YouTube is back. Though the matter is resolved, it has been resolved, and thus we resolve that it is resolved. ⬅️ That is called a formal shrug, Shakespearean-level dithering. We do...

Microsoft Clipchamp: The Incredible Shrinking App

This is hilarious. I'm on Windows 11, I use Microsoft Clipchamp often to edit videos. There's this quirk since last week or so. This is how big the application upon starting a new session: It gets smaller each time. 🤣 It's fine, since the maximise button can still be clicked until it can't. 😂 This is utterly comical. Somewhere in the development room: Bob : Done, mate. All unit tests passed. Merged to staging. Gary: : (Sipping coconut tree.) Well? Ship it, then. Bob : Where's James? Don't we need his QA brilliance? Gary: : (Sipping coconut...
Monkey Raptor uses cookies or biscuits 🍪 for analytics, functionality, and advertisements. More info in Privacy Policy