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 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.