Skip to main content

Posts

Showing posts from February, 2025

Legion

Hello, I do own a Legion laptop from Lenovo. Not free though. Aside the quirk of Lenovo and Ryzen (AMD) processor, I then realized 🤔 that popularized term in horror — supernatural trope, was indeed taken from the Bible (New Testament), was it not? These excerpts: Mark 5:1-20 Matthew 8:28–34 Luke 8:26-39 I put Mark 5:1-20 as the first in order because the story there is more vivid compared to the other versions. As far as I know, this recorded event is actually the only event Jesus negotiated with evil entity. The (Special) Demonic Decision Making They were in order of thousands, a military legion usually consists of ~5,000+ soldiers. I first thought those demons functioned as a single collective hive mind, like Cherubim . But then in the story, they begged to be sent into those 2,000 pigs. Meaning each of them had free will perchance and surely can separately occupy one pig. Woo, piggy ride! But they did have spokesdemon: Oh please, please, guv'nor! S...

CSS: Aspect Ratio

Background Prior to 2021, I was doing it with JavaScript. Using getComputedStyle combined with window resize listener to (re)define the height of an iframe 😐 But now, we have aspect-ratio . So.. begone all that hassle Here's how we do it purely using CSS. Example Implementation For example, we want to embed an iframe from YouTube to our blog and want the thing to be responsive, as in using 100% (or other percentage) of width of the container and let the height automatically follows the ratio (done by browser). Let's use 16:9 ratio for this example. We get this kind of embed code from YouTube usually: We can omit the height , width , and frameborder from it, and add class for the iframe . Let's use YT_EMBED as the class of the iframe . For clarity, I'll make the attributes to have new lines. So then it will look like this: And then, we define the CSS rules for that class .YT_EMBED . Put all together, it will look like this: ...

YouTube: New Cinematic Experience

This was from my music listening experience. I was listening Blue playlist, and Best In Me popped in. I was, oh that is brilliant refrain . Then I actually watched the video. And oh, wait a minute, what happened to YouTube video layout? 🤔 Why there's no black bars on top and below the video? The music video is actually beyond 2.39:1 ratio (21:9). It's more to 2.55:1. I saw it: WHOA 😂 that is funky 😎 I guess it's YouTube's new feature. ChatGPT be like: At this rate, YouTube will soon introduce a 360-degree wraparound screen—because why stop at just ultra-wide? I'm staying out 😂 And speaking about "staying out", here's a song from Paul Gilbert, Down to Mexico .

JavaScript: Sleep Function

We sometimes need a thing to delay the execution of the next function. There is no built-in method to do that. But, it is possible by implementing both Promise and setTimeout . In prior times, we only had setTimeout , or combined using setInterval . That worked. But now, we have Promise . So let's use it. Create the Function Let's name our function as sleep . /** * Delays execution for a specified duration. * * This function returns a Promise * that resolves after the given number of milliseconds. * It can be used to introduce asynchronous delays * in JavaScript code. * * @param {number} ms - The duration of the delay * in milliseconds. * @returns {Promise<void>} A Promise that resolves * after the specified time. * */ function sleep(ms) { return new Promise(function (resolve) { setTimeout(resolve, ms); }); } Or we can compact that using arrow expression, as such: const sleep = (ms) => (new Promise((resolve) => s...

Blogger Template Formatting: The Secret to Perfect Indentation

Have you been wondering how to make your Blogger XML easy on your eyes and your blood pressure? I bet you have. But since nobody talks about this (maybe), then I shall talk about this 🫡 5,000+ lines of code is not something to take lightly. We need consistent indentation to clearly see where each tag begins and ends. This Is An Example THREE MAGIC STEPS We select everything on the XML template. Hit: CTRL + A Put some "fake" indentation by pressing TAB Finally, hit: SHIFT + TAB Afterward, we can save that. This auto indentation feature also works in post edit/create! Actually, we do not need to make the "fake" indentation, that was just me doing it because I am used to VSCode behavior. Probably even VSCode does not need it 🤔 But that does not matter at the moment. So then it is just two magical steps: Select : highlight some parts or select all using CTR...

Alphabet

I was curious about our writing letter system, the Latin script. It consists of A through Z. The system has no Alpha or Beta. Alpha (α or A) and Beta (β or B) are within Greek script. And the most baffling is the writing direction, Abjad has it right, pun intended. They start from right to left, that is natural for any right handed person to write like that, am I right? Or, in Logographic system (Kanji, Kana, Hanja — Chinese, Japanese, Korean) has it from top to bottom AND RIGHT TO LEFT (back in those days) — it's natural. Left to right feels awkward at time. I was a left-handed child, but then time made me a right-handed man 😂 You know, tradition. After discussing this with ChatGPT, I now can safely and fully blame the timeline tinkerers who ruined what could have been an actually logical writing system. It goes something like this: Phoenician system (~1050 BCE) The Original Gangster of many writing systems. It was the origin of Abjad, only consonants...

Blogger AND Operator

I was skimming through this theme template XML , and I noticed there was the and being used inside the condition of b tag. The last image above, you can see even OR operator is written conveniently as or ! Perhaps that is not new to some of you, but to me, that is NEW! 😄 I do actually implement that to my own logic in the Blogger XML template. This is like BEGONE TEDIOUSLY STACKING b TAGS 😂 But of course, it again depends on the logic. We can do this: if (condition_1) { if (condition_2) { // condition_1 AND condition_2 are satisfied } else { // Only condition_1 (outer) is satisfied } } else { // None of the condition } Or this: if (condition_1 && condition_2) { // condition_1 AND condition_2 are satisfied } else { // None of the condition } Example I mostly implement the latter, the second one, the "Or this:". So it's quite convenient to write it like "regular" coding syntax. ...

Chess: Caro-Kann Defense With Awkward Mid-Game

I was playing offense (white piece), and started it with the famous e4 , woohoo 👯‍♀️ At fourth banter, my opponent did adventurous move there with f5 response after my e5 peon move. Then, awkward piece placements happened. Unfortunately for my oppenent, I ended up having way better position after I did I don't care moves 🤣. The part where, oh my horse on g5 is pinned, ah well, whatever, mate. Take it. Then... clink clank clunk 😕 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.

JavaScript: How to Filter Duplicate Items in Array

The most straightforward method for that is the JavaScript Set method. Remember that math subject about Venn diagram ? In it, the Set cannot have duplicates. Like the word "BOB". The set from the word will be {B, O} , and not {B, O, B} . The similar concept in JavaScript Set . This Set direct filtering works only for String and Number items from an Array . Input Array For example, we have these: const myNumber = [0, 2, 3, 4, 5, 2, 0, 4] const myString = ["a", "b", "c", "dee", "dee", "doo", "bee"] const myMix = [2, "b", 2, "dee", "dee", 0, "b"] Filtering Duplicates Using Set Method Then the straightforward method to filter the duplicates can be done like so: [...new Set(inputArray)] The new Array from that will consist of unique item. Helper Function Let's wrap that method into a helper function: function removeDuplicates(inputArra...

Monkey Raptor V.2: Premium ‘Connection Closed’ Feature!

🤣 But hey, now we're looking at new layout! 🥳 It was from my "boredom" over the old messy over-customized HTML on the old blog theme. Then I did this, yet another messiness. BUT, it is a comprehensible messiness. I wanted to structurize my customization, so I thought, hey, why not build another one? Hey, yeah. Hey. 🤔 The Steps Export the XML from the old (reference) blog. It consists of all posts, comments, pages, etc. But without the customization, only the content. Here on Blogger, we can do it by accessing: Settings > Manage Blog > Back up content . Create a new blog from the upper left side of Blogger dashboard. Then, name the new blog and pick a good theme for it. If you want, you can always get the template from other than what Blogger provides. Me, I picked the one which was already there. This layout is Notable theme, the Antique theme color variant. Import th...

Blogger: How to Implement OR Operation Within b:if Block

AND The AND condition can be implemented by stacking the b:if 's. For example: [...custom content...] [...custom content -- inner b:if...] [...custom content -- inner b:if...] [...custom content -- outer b:if...] OR The OR on the other hand, is done by actually placing OR operator, || , or the keyword or within the b:if condition. For example, we want to show custom content or executing script only on static page OR item (post): [...custom content here...] OR: [...custom content here...] We can put more than two conditions for the OR . condition-1 || condition-2 || condition-3 || ... || condition-N OR: condition-1 or condition-2 or condition-3 or ... or condition-N OR WE MIX THEM 😂 condition-1 || condition-2 or condition-3 or ... || condition-N That actually works! But it will confuse yourself, thus I recommend to pick and consistently use either one, the pipes or the "o...