An Idiosyncratic Blog

All Snippets

๐Ÿ”Ž Quick search git projects from the command line

Terminal

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

๐Ÿ“š Deploy Storybook to a sub-folder

React

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

โฑ Add delay to a request in ExpressJS

NodeJS

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

JavaScript

Better Ways of Comparing a JavaScript String to Multiple Values

๐Ÿง™โ€โ™‚๏ธ Git sorcery

Git

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

JavaScript

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

๐Ÿถ Automate linting with Husky

Husky

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

โฒ Async/Await and handling errors

JavaScript

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

โ›“ Revisiting Arrays in JavaScript

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>

Gatsby

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

๐Ÿงฒ Using Context with a HoC

React

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

JavaScript

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

๐Ÿ›ฐ Analytics using Beacon API and Ping

JavaScript

Alternative methods to fire analytics and logging APIs in JavaScript

๐ŸŽš Switch to Object Literals

JavaScript

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

๐Ÿ— Builder Pattern with a Fluent API in JavaScript

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

Gatsby

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

๐ŸŒ Holy Grail layouts in Gatsby

Gatsby

Exploring how to create a shared layout system in GatsbyJS

๐Ÿ“ญ Use 'http://local.dev' instead of localhost

Networking

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

โ™ผ Writing re-usable logic with React Hooks

JavaScript

extracting reusable logic to a custom hook

โ€ผ๏ธ The difference between String.match() and String.matchAll()

JavaScript

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

๐Ÿช Setting Cookies in Next.js

Next.js

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

๐ŸŒ How to get Local IP address on a Mac

MacOS

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 Array.at() method

JavaScript

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

JavaScript

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

๐Ÿ›  Customize CSS Loader options in Next.js

JavaScript

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

๐ŸงŸโ€โ™‚๏ธ How to keep a Docker container alive

Docker

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

TIL

Today I Learned,using global class selector with CSS Modules