About This Section

My foremost goal with blogging was to write well-researched, in-depth opinions/pieces. And that’s what I still do. However, every day I face plenty of small annoying problems whose solution involve some struggle. In most of the cases, they stay unwritten. It might not be obvious, but writing this stuff has the potential to save immense effort of the people facing the same issue. This sub-section is exactly for that—writing stuff related to programming, design, math that I learned today.

How to Create a Favicon for Dark Mode?

Dark mode is getting wildly popular these days ever since Apple shipped it with Mojave. However, the usefulness of dark mode can be negated by websites that are predominantly white. That’s why Webkit introduced a media query attribute, prefers-color-scheme, to enable developers to apply styles specific to dark mode. As of April 2019, the support for it is still poor, but it’s on the roadmap for both Firefox and Chrome. The support percentage is bound to climb up once both these browsers start supporting it.


How to Create a Flat Select Element that is consistent in all browsers?

Form elements looking different across browsers is a well-known problem, but the <select> element is especially problematic in this regard. If I try to change the default styling of <select> by increasing its height (which, by default, is too small), the dropdown menu starts to look drastically different in all major browsers. Not to mention that it’s plain ugly in Firefox and Safari.


How to Create a Custom Formula in Google Sheets?

Google Sheets is an incredibly powerful tool. But did you know you can extend its powers by creating your own formulas? Although Google Sheets already comes with multiple functions to do higher-level things (IF..THEN, SWITCH, QUERY), custom formulas can help you do more advanced stuff and can often be simpler and more maintainable solutions.


How to Render Human Readable Time in Jinja?

From a UX perspective, human-readable (or humanized) time is a must-have. “5 hours ago,” instead of “22th Dec, 2018 09:18:18 AM” is so much easier to parse. To render timestamps in that format inside a Jinja template, we can create a filter in the flask application code.


How to Uppercase the First Letter in Jinja?

I have been using Jinja for my side-project and was surprised to find that there’s no way to uppercase only the first letter. There is a capitalize filter but it also lowercases the rest of the letters—something you wouldn’t want if your text has acronyms or proper nouns. Jinja doesn’t support sentence case by default, but thankfully it’s not hard to recreate that.


How To Create a Responsive Menu with UIKit?

UIKit has become my de-facto standard for any new project. It’s simple, the default look is refreshing, and there are tons of useful components and utility classes. In most cases, it gets the job done without getting in the way. However, coming from the bootstrap world, one thing I dearly missed was the collapsible navbar.


Why does subresource integrity (SRI) need the crossorigin attribute?

Subresource Integrity (SRI) is a new security feature that safeguards websites against tampering of a script/stylesheet at the source. Say, you want to include a script from a public CDN, but you also protect yourself against potential manipulation of the code after you have included it, SRI is the way to go. The feature gives the developer the ability to add a hash-sum with the script tag. Before the browser loads the resource, it will match the hash-sum of the content with what is specified in the tag. If they are equivalent browser proceeds with execution, otherwise it’s blocked.