Snippets

Reuseable code snippets collected by me

JSX Reusable Snippets

Certainly! Here are some reusable code snippets in JSX that can help streamline your React development.

Getting Spotify token

How to get Spotify token and use it to display now playing track on your website

Casing Utilities

Useful string casing utility functions in JavaScript

Case sensitive renaming

Learn how to safely rename a case-sensitive file or directory in a Git repository.

Deep remove falsy

Remove all falsy values from an object and its nested children in JavaScript and TypeScript

Use an async effect

Learn how to create and use a custom hook to handle asynchronous side effects in React.

Color validator

A simple JavaScript utility to check if a string is a valid CSS color.

Kill that process

Quickly find and kill processes running on specific ports in MacOS using terminal commands.

Markdown code block syntax

Learn the basic and advanced syntax for code blocks in Markdown, including language highlighting, filenames, and line numbers.

Event Emitter

A simple implementation of the Event-Emitter or PubSub pattern in JavaScript.

Date utils in Liquid

Adding/subtracting days in Shopify's Liquid template language

Read file names

Learn how to quickly read and list all file names in a directory using Node.js

VNese to plain English

Learn how to replace Vietnamese diacritic letters with their plain English equivalents using JavaScript and regex.

.gitignore tip

Learn how to ignore all files in a directory except a specific file using .gitignore

useLocalStorageState

Learn how to create and use a custom hook that syncs state with local storage in React.