<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[All Things Tech]]></title><description><![CDATA[A technologically-adept explorer of the digital realm. With my boundless passion for the command of the elusive language of code, success in cyber inovations is]]></description><link>https://blog.kiruiallan.me</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 10:40:20 GMT</lastBuildDate><atom:link href="https://blog.kiruiallan.me/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[AdFriend - Your Ad Blocking Sidekick]]></title><description><![CDATA[Let me introduce you to AdFriend — a customized Chrome AdBlocker that not only blocks annoying ads on your browser but also replaces them with meaningful content based on your preferences.
This article focuses more on the technical development rather...]]></description><link>https://blog.kiruiallan.me/ad-friend-your-ad-blocking-sidekick</link><guid isPermaLink="true">https://blog.kiruiallan.me/ad-friend-your-ad-blocking-sidekick</guid><category><![CDATA[chrome extension]]></category><category><![CDATA[ads]]></category><category><![CDATA[adblocker]]></category><category><![CDATA[software development]]></category><dc:creator><![CDATA[ALLAN]]></dc:creator><pubDate>Mon, 10 Mar 2025 22:26:55 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1741643120237/36d81f8e-0c0d-4941-abbc-dab4396c9878.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Let me introduce you to AdFriend — a customized Chrome AdBlocker that not only blocks annoying ads on your browser but also replaces them with meaningful content based on your preferences.</p>
<p>This article focuses more on the technical development rather than the product itself — the story of my sleepless, coffee-driven nights and a testimony that you can, in fact, bite more than you can chew :)</p>
<h2 id="heading-deep-dive">Deep Dive</h2>
<p>This project was actually inspired by Julien Barbier’s challenge, and at the time, I had no idea, let alone, experience on building Chrome extensions. But that didn’t stop me from diving headfirst into the rabbit hole. Armed with way too many open tabs, a half-functioning debugger, and a vague understanding of how Chrome APIs worked, I set out to build something that could block ads and replace them with something better.</p>
<p>The first hurdle? Figuring out how to intercept and modify web requests. Chrome’s <code>declarativeNetRequest</code> API seemed like the right choice—until I realized its limitations when trying to inject custom content. That led me to <code>chrome.scripting</code>, which gave me the power to manipulate DOM elements dynamically. Sounds easy, right? Yeah, until you’re debugging scripts injected into a page that reloads every time you test it.</p>
<h2 id="heading-the-why-is-this-not-working-phase">The "Why Is This Not Working?" Phase</h2>
<p>If you’ve ever built a Chrome extension, or anything that involves code for that matter, you know that things never go smoothly the first time. Or the second. Or the tenth.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741643203509/c24fe7d8-148f-483f-aeb1-207db8b78c31.webp" alt class="image--center mx-auto" /></p>
<p>One of my biggest struggles was getting permissions right in <code>manifest.json</code>. I must have gone through a dozen iterations, each time getting slapped with vague errors that felt more like riddles than actual debugging hints. At one point, I had an extension that could block ads… but not replace them. Then, I had one that replaced ads… but only after a manual refresh. And, of course, the version that worked perfectly—except on actual websites people use.</p>
<p>At 3 AM, fueled by coffee and stubbornness, I finally had a breakthrough: instead of replacing ads post-load, I needed to hook into the page lifecycle earlier using a <code>MutationObserver</code>. This allowed AdFriend to detect and swap out ads as soon as they appeared, creating a seamless experience.</p>
<h2 id="heading-adding-the-meaningful-part">Adding the "Meaningful" Part</h2>
<p>Blocking ads is one thing, but replacing them with content tailored to the user? That was another challenge altogether. I built a simple preferences system that let users choose what kind of content they wanted—motivational quotes, coding tips, news snippets, or even their own custom messages.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741644705694/a42d2245-2093-49f1-b9b8-09241b3f32ba.png" alt class="image--center mx-auto" /></p>
<p>This involved setting up a lightweight storage system using <code>chrome.storage.sync</code>, allowing settings to persist across sessions. From there, a small content-fetching module pulled relevant snippets and dynamically inserted them in place of ads. The first time it worked properly, I stared at the screen for a good minute, trying to process the fact that I had actually made it work.</p>
<h2 id="heading-lessons-learned-and-a-few-regrets">Lessons Learned (and a Few Regrets)</h2>
<ul>
<li><strong>APIs are deceptive</strong> – Chrome’s documentation makes everything sound straightforward, but the reality is a game of trial and error.</li>
</ul>
<ul>
<li><p><strong>Debugging extensions is a nightmare</strong> – Unlike web apps, where you can log everything to the console, debugging injected scripts comes with its own brand of suffering.</p>
</li>
<li><p><strong>Don’t over-engineer</strong> – At one point, I considered integrating an AI-generated content system. Thankfully, I stopped myself before I went completely off the rails but that’s definitely on my to-do list regardless — nobody can stop reggae.</p>
</li>
</ul>
<h2 id="heading-final-thoughts">Final Thoughts</h2>
<p>AdFriend started as an experiment, but it turned into something surprisingly useful. It’s not perfect, but it works—and more importantly, I built it from scratch with zero prior experience in Chrome extension development. If you’re thinking of creating your own extension, my advice is simple: start small, expect chaos, and just keep pushing through.</p>
<p>Now, if you’ll excuse me, I need to catch up on all the sleep I sacrificed for this project. Ohh, and please try it out yourself <a target="_blank" href="https://github.com/kc-allan/ad-friend">here</a></p>
]]></content:encoded></item><item><title><![CDATA[The Zen of Python]]></title><description><![CDATA[Python was introduced into the programming scene in 1991 by Guido van Rossum in the Netherlands as a successor to the ABC programming language.
Improvements and new releases have ever since been made despite Rossum leaving the team and giving up his ...]]></description><link>https://blog.kiruiallan.me/the-zen-of-python</link><guid isPermaLink="true">https://blog.kiruiallan.me/the-zen-of-python</guid><category><![CDATA[Python]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[software development]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[ALLAN]]></dc:creator><pubDate>Mon, 10 Apr 2023 15:57:37 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/ieic5Tq8YMk/upload/a0fb7ba1f33259ea5fb2a46cad26352c.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Python was introduced into the programming scene in 1991 by Guido van Rossum in the Netherlands as a successor to the ABC programming language.</p>
<p>Improvements and new releases have ever since been made despite Rossum leaving the team and giving up his title as "<a target="_blank" href="https://en.wikipedia.org/wiki/Benevolent_dictator_for_life">Benevolent Dictator for Life</a>" of python on July, 2018 when he announced his retirement. (from the name I guess he still holds the title though)</p>
<p>Without getting to all things python and it's cool features, I'll deep dive into what's called the Zen of Python, a concept unique to python and sparks curiosity vis-a-vis the python language.</p>
<p>The Zen of Python is a set of 19 guidelines introduced by Tim Peters, an American software developer and big contributor to the CPython framework. He came up with these guidelines that define programming best practices especially in the implementation of Python.</p>
<p>To view the zen of python locally:</p>
<ol>
<li><p>Create a <code>main.py</code> file</p>
</li>
<li><p>Copy the following code to you <code>main.py</code> file:</p>
</li>
</ol>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> this
</code></pre>
<ol>
<li><p>Run the file in the terminal as <code>python3 -m main.py</code></p>
</li>
<li><p>Output:</p>
</li>
</ol>
<pre><code class="lang-plaintext">The Zen of Python by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one -- and preferably only one -- obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
</code></pre>
<h2 id="heading-below-i-give-insight-on-every-line-of-the-zen">Below I give insight on every line of the Zen</h2>
<p><strong>"Beautiful is better than ugly."</strong> - Besides functionality, code should also be easy to read and aesthetically pleasing.</p>
<p><strong>"Explicit is better than implicit."</strong> - Code should be obvious from any reader's point of view (another programmer of course) rather than relying on background behaviors.</p>
<p><strong>"Simple is better than complex."</strong> - Code implementation should be simple while maintaining optimum functionality.</p>
<p><strong>"Complex is better than complicated."</strong> - If code complexity is at all necessary make it straightforward.</p>
<p><strong>"Flat is better than nested."</strong> - Code structure should avoid exaggerated nesting of control structures.</p>
<p><strong>"Sparse is better than dense."</strong> - This emphasizes on paragraphing code to enhance readability.</p>
<p><strong>"Readability counts."</strong> - Quite straightforward; code should be readable.</p>
<p><strong>"Special cases aren't special enough to break the rules."</strong> - Python comes with guidelines and conventions of writing code; manipulating code to go around the conventions in an attempt to execute a "special" behaviour is therefore not an option.</p>
<p><strong>"Although practicality beats purity."</strong> - Well practically achieving a behaviour under restricting guidelines may be hard, this zen gives room for special case code to simplify the work at hand.</p>
<p><strong>"Errors should never pass silently."</strong> - Exceptions and errors must never be ignored even if it doesn't affect output.</p>
<p><strong>"Unless explicitly silenced."</strong> - Suppressing exceptions is the next alternative to managing hard to handle exceptions.</p>
<p><strong>"In the face of ambiguity, refuse the temptation to guess."</strong> - Coding should be intentionally rather than trial and error to accomplish a behaviour.</p>
<p><strong>"There should be one -- and preferably only one -- obvious way to do it."</strong> - Code should be consistent all along a program and establish flow down the lines.</p>
<p><strong>"Although that way may not be obvious at first unless you're Dutch."</strong> - This is a more of a humorous pun directed at Rossum, creator of Python, who is Dutch.</p>
<p><strong>"Now is better than never."</strong> - Implement a solution as it comes; don't be hard on perfection which may never be achieved.</p>
<p><strong>"Although never is often better than right now."</strong> - Trying to be perfect is not necessary but also take time to implement it's best attainable code solution.</p>
<p><strong>"If the implementation is hard to explain, it's a bad idea."</strong> - Code should be made easy to explain the execution flow.</p>
<p><strong>"If the implementation is easy to explain, it may be a good idea."</strong> - Code that's easy to explain is by high chance well Implemented.</p>
<p><strong>"Namespaces are one honking great idea -- let's do more of those!"</strong> - Variables and other namespaces that could be used globally in other parts of the code parts of the code is always better than constantly defining code.</p>
<hr />
<p>The Zen of Python is not necessarily a contract with consequences if broken but rather a friendly guideline to any developer out there; novice or expert. So take your time on every Zen.</p>
<p>✌️</p>
]]></content:encoded></item></channel></rss>