Posted on Leave a comment

My customizations are now a WordPress child theme

This website uses a theme called Storefront. It’s a minimalistic yet elegant theme from Automattic (the creators of WordPress). I literally browsed hundreds of modern and ‘top’ themes at various sources before falling for this one. It was a good fit in its vanilla form and required only little customizations to suit my needs.

Yesterday I logged into my WP admin after a few days and saw several updates piled up. Storefront was one of them. I didn’t upgrade right away for I knew my customizations would be go away with its previous version. I had committed the cardinal sin of modifying the theme directly.

When I found out about the concept of child themes, I said to myself, “shit, I should have guessed already.” A child theme is one that contains files and assets you want changed in a ‘parent’ theme. So, rather than directly editing style.css or functions.php in a parent theme, one can create a child theme and add their modifications there. That’s what I did then. I created a child theme called Storefront AB, derived from the beautiful Storefront theme.

That was fun. It’s live now!

WordPress is a beautiful, sophisticated software, built to scale to millions of websites globally. A lack of something like the concept of child theme didn’t just feel right. I should have trusted my instincts earlier.

Posted on Leave a comment

Declarative Programming

One of my latest obsessions is GraphQL. While reading a tutorial, I found out that GraphQL follows declarative programming paradigm. The video tutorial gave examples to differentiate imperative paradigm that REST technologies use from declarative paradigm that GraphQL uses to make our lives easy. It was not the first time I’d come across these two terms, just that in all previous instances I didn’t care enough to investigate them in detail. When I, however, did dig deeper I was pleasantly surprised.

This stackoverflow thread does a good job in explaining the contrast. So, what some people see as convenience features of C# (when comparing with Java) is actually its declarative style of programming. As a developer obsessed with convention over configuration, it was not hard to fall for this style.

Posted on Leave a comment

Flutter is riding the adoption curve

It’s getting serious everyday. It’s not just the internet, a lot of people around me are talking about it. So, it did not come as a surprise when I found that a popular Indian app was built in Flutter. Dream11 is what people are talking about this IPL season. Given the massive fan following of IPL and the craze for safe online betting, one thing is sure — Flutter can damn well handle scalability. I do not use the app myself, but it sure looks pretty on friends’ phones.

I am getting more and more impatient now to build my next mobile app in Flutter. Until that happens and I have stories to tell about my time with Flutter, watch Dream11’s Flutter story:

Posted on Leave a comment

A little bit of LaTeX

I’ve been busy watching videos. A lot of them, as part of my learning process for quantum computing. To concretize my learning, I’ve been taking notes. As quantum computing is hardcore math, it’s impossible to not have some sort of equations in notes. I’ve never needed to learn or use LaTeX before: all simple algebraic equations can be written in plain text using some jugaad, say using superscripts for exponentials. But how do you represent column vectors and matrices? That’s where LaTeX comes super-handy. As I’m using it more, the more fun it gets.

Auto-LaTeX Equations is an excellent add-on for Google Docs that makes it super-easy to write LaTeX code and convert it into good-quality images of math stuff and equations.

An example LaTeX render from my notes is this matrix that represents the phase shift quantum gate:


Posted on Leave a comment

My first cron job

That’s right. Believe it or not. I created my first cron job TODAY! This is what it looks like:

0 4 * * * cd /var/www/mysite/ && node gmailscripts/watch.js my-email-id@gmail.com

It’s a very simple job that calls a Node.js script to renew a watch I have on one of my Gmail accounts. at exactly 4:00am daily. Now, what is a watch or why I am watching my mailbox are beyond the scope of this little blog post. Basically, I have a nifty little Node.js API that I use as a webhook to get notification updates from Gmail whenever a new mail arrives. It then checks if the new mail has a specific subject and from address, which when true instructs the API to call a custom parser to scan the contents of the new mail and return me important bits of information that I then save in a database. Geeky? Perhaps it is. I plan to do a separate blog post on how you can do the same (not setting up cron, but watching Gmail mailboxes for new mail programmatically).

Back to cron again: it’s not that I didn’t know the concept of automated jobs before (in Linux or otherwise), I guess I never really needed to create a scheduled job before. Creating the job was not as much fun as reading the correct way to do it. I followed this Digital Ocean community tutorial, which is now 6 years old but stays relevant today.

On this topic, in my professional life I’ve literally seen people learning about this ‘cool’ tool and then misusing it for all sorts of software development things that can be (and should be) done using some form of publish-subscribe or message queue design pattern.