An Idiosyncratic Blog

All Snippets

🔎 Quick search git projects from the command line


Simple alias to quickly search git projects from the command line.

📚 Deploy Storybook to a sub-folder


A quick hack to deploy Storybook to a sub-folder.

⏱ Add delay to a request in ExpressJS


A tiny middleware to simulate delay in response to a request. This is useful for testing and debugging.

🧱 Ditch the long if, use array.includes


Better Ways of Comparing a JavaScript String to Multiple Values

🧙‍♂️ Git sorcery


A peculiar but not so rare use-case of git when you forget to change branch after doing a commit.

🔖 Vandalize the web with Bookmarklets


Quick intro to bookmarklets and how to create one for life hacks

🐶 Automate linting with Husky


Using Husky for a git hook to format code on commit and before push

⏲ Async/Await and handling errors


Dealing with async-await hell to write simpler and easy to understand code

⛓ Revisiting Arrays in JavaScript


In this post, I'll talk a bit about different ways to create an array in JavaScript and ways to empty an array.

🔎 Syntax Error: Expected Name, found <EOF>


Solving an error without Googling it first is kind of not time saving.

🧲 Using Context with a HoC


How to use Context Provider to avoid props drilling? Bonus, cleaning up multi-context tree hell using a Higher order Component.

🛠 JavaScript Utils: Part One


A set of JavaScript utilities which I found when scraping the internet.

🛰 Analytics using Beacon API and Ping


Alternative methods to fire analytics and logging APIs in JavaScript

🎚 Switch to Object Literals


Is switch statement good? Is there something better out there?

🏗 Builder Pattern with a Fluent API in JavaScript


Exploring builder pattern in JavaScript, taking some hints from Java builder patterns

🔥 Efficient workflow with ESLint and Prettier

Code formatting

How I configure ESLint and Prettier to catch style and code issues early on

📥 Sharing state in Gatsby


Exploring how to create a shared state management system in GatsbyJS using Context Provider API

🌐 Holy Grail layouts in Gatsby


Exploring how to create a shared layout system in GatsbyJS

📭 Use '' instead of localhost


Configuring localhost to use a domain name to make development simpler to identify multiple apps

♼ Writing re-usable logic with React Hooks


extracting reusable logic to a custom hook

‼️ The difference between String.match() and String.matchAll()


match and matchAll can be used to match string using regex. But are they same?

🍪 Setting Cookies in Next.js


Snippet showing how to set cookies for a given url in Next.js

🌍 How to get Local IP address on a Mac


If you're on macOS and you want to get the IP address within your local network, there are a few ways of doing this.

👋🏽 Meet the new method


Arrays are one of the widely used data structures in JavaScript. You can have objects in an Array. You can have functions in an Array. You can have arrays in an Array. It's bonkers.

👨🏽‍💻 How to merge Arrays in JavaScript


In this post, we look at various ways to merge arrays in JavaScript

🛠 Customize CSS Loader options in Next.js


A snippet showing how to override css-loader options in Next.js

🧟‍♂️ How to keep a Docker container alive


Docker containers usually do not sit around for long when a process running in it crashes. So how to keep it running even when the process crashed?

🎨 Using global class selectors in CSS Modules


Today I Learned,using global class selector with CSS Modules