All Snippets
๐ Quick search git projects from the command line
TerminalSimple alias to quickly search git projects from the command line.
๐ Deploy Storybook to a sub-folder
ReactA quick hack to deploy Storybook to a sub-folder.
โฑ Add delay to a request in ExpressJS
NodeJSA tiny middleware to simulate delay in response to a request. This is useful for testing and debugging.
๐งฑ Ditch the long if, use array.includes
JavaScriptBetter Ways of Comparing a JavaScript String to Multiple Values
๐งโโ๏ธ Git sorcery
GitA peculiar but not so rare use-case of git when you forget to change branch after doing a commit.
๐ Vandalize the web with Bookmarklets
JavaScriptQuick intro to bookmarklets and how to create one for life hacks
๐ถ Automate linting with Husky
HuskyUsing Husky for a git hook to format code on commit and before push
โฒ Async/Await and handling errors
JavaScriptDealing with async-await hell to write simpler and easy to understand code
โ Revisiting Arrays in JavaScript
JavaScriptIn 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>
GatsbySolving an error without Googling it first is kind of not time saving.
๐งฒ Using Context with a HoC
ReactHow to use Context Provider to avoid props drilling? Bonus, cleaning up multi-context tree hell using a Higher order Component.
๐ JavaScript Utils: Part One
JavaScriptA set of JavaScript utilities which I found when scraping the internet.
๐ฐ Analytics using Beacon API and Ping
JavaScriptAlternative methods to fire analytics and logging APIs in JavaScript
๐ Switch to Object Literals
JavaScriptIs switch statement good? Is there something better out there?
๐ Builder Pattern with a Fluent API in JavaScript
JavaScriptExploring builder pattern in JavaScript, taking some hints from Java builder patterns
๐ฅ Efficient workflow with ESLint and Prettier
Code formattingHow I configure ESLint and Prettier to catch style and code issues early on
๐ฅ Sharing state in Gatsby
GatsbyExploring how to create a shared state management system in GatsbyJS using Context Provider API
๐ Holy Grail layouts in Gatsby
GatsbyExploring how to create a shared layout system in GatsbyJS
๐ญ Use 'http://local.dev' instead of localhost
NetworkingConfiguring localhost to use a domain name to make development simpler to identify multiple apps
โผ Writing re-usable logic with React Hooks
JavaScriptextracting reusable logic to a custom hook
โผ๏ธ The difference between String.match() and String.matchAll()
JavaScriptmatch and matchAll can be used to match string using regex. But are they same?
๐ช Setting Cookies in Next.js
Next.jsSnippet showing how to set cookies for a given url in Next.js
๐ How to get Local IP address on a Mac
MacOSIf 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
JavaScriptArrays 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
JavaScriptIn this post, we look at various ways to merge arrays in JavaScript
๐ Customize CSS Loader options in Next.js
JavaScriptA snippet showing how to override css-loader options in Next.js
๐งโโ๏ธ How to keep a Docker container alive
DockerDocker 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
TILToday I Learned,using global class selector with CSS Modules