July 12, 2023 — I was working on this little app that lets you convert any text to a slug. And while working on it, I came across this problem where I had to replace accented characters with their plain English counterparts.
July 5, 2023 — There comes a time when you need to scrape a website for data. For instance, you might want to scrape a website to get the list of all the products they have or you might want to scrape a website to get the list of all the blog posts they have. Or you just want to automate the process of scraping a website for data to make your life easier.
July 1, 2023 — If you’re working on a large codebase, chances are you might have installed a lot of npm packages in your project. And you might have used some of them just for the sake of trying them out. But, you might have forgotten to remove them from your
March 7, 2023 — I was browsing through my Twitter feed and I saw something pretty subtle yet mind-blowing. One of the guys from the Astro team was showing off some of the new things they have done for their brand redesign.
false) or boolean expression to check for the condition.
November 8, 2022 — Slugs are the part of a URL that identifies a particular page on a website. For example, in the URL
search. It is also known as the URL segment or the permalink.
October 11, 2022 — Here’s a little tip that I learned recently. It’s about destructuring an object and aliasing the destructured variables. I’ll show you how it works with an example.
...) can be used to spread the properties of an object.
September 18, 2022 — Recently, I stumbled upon a problem where I had to toggle the state of the checkbox based on the viewport width. So, let’s say, if the viewport width is changed and is less than
879px and the checkbox is checked, then it should be unchecked.
...) to do so.
May 21, 2022 — I was working with a group of checkboxes under a redux-form for one of my applications. So, when I select certain checkboxes here’s the format in which I was getting the value of the checkboxes.
May 17, 2022 — The other day when working with one of the applications, I needed to convert/reduce an array of objects to an object.
March 22, 2022 — Haters gonna hate and call you uncultured but when it comes to debugging, doing
console.log() is one of best the best ways of all time. Period. Well! sort of!
March 21, 2022 — The other day, I was stumbled upon a scenario where I need to check whether there exists at least one key of a certain value in an array of objects.
January 12, 2022 — Working with currencies is the use-case that you might find yourself stumbled upon more often than not. And one of the aspects of it is to display the currency on the frontend.
December 22, 2021 — One of the most important features of ES6 is destructing of arrays and objects.
August 24, 2021 — Regular expressions (RegEx) are great little strings that help in solving some of the complex problems that are rather hard if we don’t use the RegExes.
July 11, 2021 — Oftentimes, you might end up in situations where you have an array and you just want to deflate the entire array content in a human-readable form. Or more specifically in a list-like format.
May 3, 2021 — Sometimes, there might be a use case where you want to change the URL’s query parameters as you type in an input field.
April 27, 2021 — Recently, I added a set of few keyboard shortcuts on this blog which helps in navigating through different parts of the blog conveniently. You can check all the shortcuts on this dedicated page.
January 16, 2021 — Currently, there are two ways if you want to create ES6 class components in React.
January 13, 2021 — There are a lot of reasons where you would want to “deep copy” objects in your application. For instance, when working with React.js, you might have used the
shouldComponentUpdate life-cycle method. In this method, you would determine if the component has the same props and state as it had previously by shallow or deep copying objects.
July 28, 2020 — The usual way of adding event-listener on certain elements is using the
addEventListener method on the element. For instance, if you want to register a click event on an element with id
checkoutBtn, you can do it like so.
July 27, 2020 — I was working on implementing the Konami code easter egg on this blog and there was this need where I need to stop the scrolling only when the previous two presses by the user are
June 23, 2020 — While working on Your First Commit Ever, there arised a requirement in which I had to update/change the URL’s query paramter based on the user input.
June 2, 2020 — There comes a scenario when you might want to check which operating system the device is running. For instance, when you want to set device-specific download links. For windows,
.exe file, for macOS,
.dmg file and so on.
May 19, 2020 — There might be cases where you would like to check if the device on which the website is loading is connected to the internet or not. For instance, this can be used to show the user the message if their device is offline or to disable some functionality of the application if the device is offline.
May 18, 2020 — You’ve probably seen or have used this feature where you can upload files by dropping the selected files into the specific area. For example, how Gmail handles this while drafting emails.
May 11, 2020 — Implementing a Dark mode in applications is all the rage these days. And you can provide a toggle to switch between Dark/Light mode to users like the one I’ve implemented on my Notepad app.
April 8, 2020 — I was working on polishing my Notepad app this fine quarantine afternoon. One feature that I was planning to add was an ability to download the content of the notes/text as a text file when user click the specified download button.
for...of. All these constructs loops over synchronous iterables such as arrays, objects, strings etc.
December 22, 2019 — When using React component using ES6 classes, you must have encountered this phenomenon where you have to explicitly bind the class function and then pass it to the even such as
onClick. For instance, take the following example.
September 3, 2018 — Progressive Web Apps are great when you need to achieve things like offline capabilities, push notifications, background-sync and to give your website an overall app-like experience. While, the PWAs are great at implementing all of the above things and are the obvious choice, there are certain things which can be broken when you use ServiceWorker(which are the building blocks of any PWA) to make your webaite a PWA.
March 21, 2017 — We all know how good is Chrome Dev Tools when it comes to the web debugging capabilities. There are number of features in the Dev Tools which are very useful but we are unaware of.