Why TypeScript

For many of the developers, TypeScript seems like a completely new language. But to me, it is just JavaScript with added type system. In this post, I am going to discuss why we should use TypeScript over plain old JavaScript. Type System Let me lead the post with TypeScript’s awesome typing-system. In plain JavaScript, there are no types. Values are assigned to variables dynamically. When I say a language is dynamic, I essentially mean that we can re-assign variables with different data types.

MySQL on Arch Linux

Yesterday, I was installing LAMP stack on my local machine to get some work done. For some weird reasons, I thought I would be able to access the database as the root user through a non-root process. Here are some notes about that just in case I encounter such issues again in future. Installation First thing first, we need mysql binary to be able to create and manipulate databases. Let me get that from Arch Package Repository.

TypeScript Webpack Setup (with CSS Modules)

It has not been many days since I started to choose TypeScript instead of JavaScript. It’s an interesting language(or a superset, as many of us would like to call) which adds so much awesomeness to Vanilla JavaScript. The most notable feature it adds to JavaScript is the TypeSafe programming. Type-safe programming simply means that a programmer is less likely to write code which would produce a type-error. Type safety is the core feature of a Statically typed language.

Generator Functions in JavaScript (with real-world examples)

Before I start writing anything, here’s a discloser: I knew about generator functions since a long time, but did not really had a chance to use them. In this blogpost, I will demonstrate implementation of generator functions in real-world scenerios. Generator Function Before we begin, let’s quickly revise what generator functions are. They are a special kind of function which is used to generate an iterator. An Iterator is an Object which implements the Iterator Protocol.

Session Management in Vim

If you ask me about the most underrated feature in Vim, my answer would be ‘Session Management’ straightaway! Just like any other “modern” editors, Vim does support sessions. What is a Session Before I go in-depth, let me explain what exactly is a Session in Vim. Simply put(from :help session): A Session keeps the Views for all windows, plus the global settings. An example of session could be: If I have opened a project and worked for an hour, and then closed it.

NeoMutt: the Command Line Email Client

Mutt is a command-line email client which can connect to IMAP/POP3 and SMTP protocols as well as read emails from local directories. So, how do I stumbled upon it? I am trying to optimize my workflow. Having to click around a GUI-based email client isn’t my thing. So, I look for alternatives. Why Mutt? because Mutt features a keybinding which is similar to Vim. This means, a single set of shortcuts would work pretty much everywhere.

Using Github Profile Readme as 'Twitter-like' Feed

I had this weird idea of using GitHub profile README as Twitter-like(well, Mastodon TBH) feed! There was no specific reason for doing so. I roughly thought it would boost my Mastodon profile(which is quite new at the moment) reach. Another reason was to see how far I could go with limited tools (as Github ReadMe does not support JavaScript yet). Generating those Cards There was only one thing to figure out.

Terminating DOM Operations at will: 'AbortController' in JavaScript

Intro AbortController is an interface which provides a way for terminating one or more web request as and when desired. This generally means that a request can be terminated by a user whenever needed, irrespective of whether the operation is finished or not. AbortSignal can be implemented in any web platform API which uses Promise. The API AbortController provides a few things for users to implement it effectively in code. At the time of writing this, the constructor would return an instance which contains a method AbortController.

Finding Duplicate Files in Linux - The Hard Way

Duplicate files, in Layman’s term, are the files which are exactly a copy of one another. For example, if we have two files biz A and B; A would be a duplicate of B if it has the same content as file B. Duplicates are generally unavoidable. No matter what you do, you would always end up getting a few of them. Going through the whole file system and finding them one by one is a tedious job.

Recording Shell Output the Right Way

TL,DR; go and install asciinema from asciinema.org and start recording your terminal sessions. We, the terminal geeks often need to record our shell in-order to explain something to our geek friends; or even just to showcase a new CLI tool we built yesterday night. Recording Screen … Sucks! Yes, it sucks. Why? couple of good reasons: if you have a device with low screen resolution, record output would often get pixelated there might be other distractions on screen.