RegEx Cheat Sheet

Image for post
Image for post

Regular expressions are sequences of characters that are used to match a certain pattern in a String. Most of the programming languages provide options to handle regular expressions or commonly called RegEx. It is generally used for finding a part of a string or to validate the string input. In real-time, they are used in search engines, finding or finding and replacing a pattern in word processors or in text editors.

Commonly used RegEx patterns

Many times we find ourselves in Regex 101 or RegExr trying to find the right RegEx to match the pattern that is required. …


Easily Test Your Application Completely

Image for post
Image for post

End-to-end tests, as the name suggests are designed to test any application from one end to another — be it top to bottom or start to finish. One might wonder why writing end-to-end test cases for any web application is even needed. Often times we only test several components in an application and not the entire flow to replicate how the user uses the application. If there’s any failure in any subsystem then it could potentially cause the entire application to break. This is a major risk and it’s always best to have end-to-end testing to avoid this.

What’s the purpose of doing E2E testing?

End to end testing basically is for the following…


Super-fast Deployment For React Applications

Image for post
Image for post

If you’re an enthusiastic developer who loves building React applications, then GitHub pages could be your best bet for hosting them. All you have to do is follow a few simple steps and you can host as many apps as you’d like straight from your repository. Sounds exciting? Read away!

GitHub Pages is a static site hosting service that takes files straight from a repository on GitHub and publishes a website. We can optionally run the files through a build process if needed. Here are the steps that you need to follow to deploy your React App:

1. Storing your project in GitHub

Make sure you store your project files in a repository in GitHub. It can either be a private or public repository. …


A Few Tips To Become A Better Developer

Image for post
Image for post

In the beginning of my career, every time I worked with JavaScript I’ve always been skeptical about if the way I write my code was right. Because, in any programming language there’s no one right way of getting things to work. Nevertheless, one must always remember the things that are not supposed to be done. So, here’s a curated list of things that should not be done in JavaScript that I would like to share.

1. Avoid using var

Always use let or const when you’re trying to declare a variable. If you have a variable that does not require a change then it’s always best to use const. You can ask, why should we not use var? It’s because ES6 has given us let that provides us with block scope that would avoid a lot of problems that would occur when using var — which is function scoped. …


GraphQL Is Way Better

Image for post
Image for post

REST has been used by many developers to send data over HTTP whereas GraphQL is typically presented as a technology to replace the legacy of REST APIs. In this article, I’ll be explaining the benefits, limitations, and differences between these two, which will help you decide what to chose for your next project.

What is REST?

REST(Representational state transfer) is an API design architecture that’s used to implement web services by using a predefined set of stateless operations (including GET, POST, PUT, and DELETE).

The core idea of REST is that you would retrieve a resource by putting through a request to the resource’s URL and get a response (usually JSON, but it depends on the API). …


You should have a set time to work, a defined workspace, and a daily routine, even though you’re at home

Scrabble tiles forming the words “work from home”
Scrabble tiles forming the words “work from home”

Ever since work from home began, my productivity has had its ups and lows until I found the right way to do it. Since then, it has been at a constant high. During the initial days, all of us must have had mixed feelings. I first thought it would be fun for a while to wake up five minutes before the first meeting and spend all day in pajamas. And I thought avoiding traffic and travel was the best thing that could ever happen to me.

But later on, when burnout kicked me pretty hard, I decided to not let it get to me. I thought it was just me, but later on, when I’d talked to my colleagues who live with their parents or the ones that have kids at home or a noisy neighbor who loves to yell all the time, I realized what the real deal was. Also, being prone to get distracted or to procrastinate has also become extremely common as we are all at home in our own space. We’re the master of our time now as there’s no one around us that we’re scared will judge us. …


Being a Performance Conscious Developer

Image for post
Image for post

Being a developer, it is essential to worry about the performance of the application that we build. Memory management is one of the major factors that affects the performance of an application. Many a time JavaScript developers tend to not consciously think about memory management because JavaScript automatically allocates memory space when an object is created and collects them later as garbage when they’re not used. These behind the scenes behaviour of garbage collection in JavaScript could cause a lot of confusion. Read further to understand this better.

Memory Life Cycle

There are three steps involved in the memory life cycle of almost all programming…


Clear Cache, JSONView, and more

google chrome logo
google chrome logo

Most of the Web Developers use Chrome for their development. According to Wikipedia about 65% of the world population seem to use Chrome, this is one of the reasons why developers choose Chrome to test an application built by them. So if you’re a developer who uses Chrome a lot, here’s a bunch of Chrome extensions that would make your life a lot easier.

1. Colorzilla

Colorzilla basically provides a color picker widget along with a lot of other features. It has a gradient generator, webpage code analyser, and everything you’d need to deal with colors in your webpage. …


Stay updated with the upcoming features to JavaScript in 2021

Image for post
Image for post

Since 2015, JavaScript has been receiving constant yearly updates with new features being added. Though ES2021/ES12 will be released next year, we can already have a look at what’s to come since many features already reached Stage 4(Finished) specification and will be included in the specification. In this article, I will discuss the features that have already reached stage four and are added to the Google Chrome V8 engine.

String.prototype.replaceAll

String.prototype.replace is an existing method that allows us to replace a pattern in a string with something else. One thing to remember in this method is that, when we replace a pattern, only the first occurrence of that pattern in the string would be replaced. …


Or Is It Synchronous?

Image for post
Image for post

The Problem

In React, we use setState() to update the state of any component. Now setState() does not immediately mutate this state, rather it creates a pending state transition. Accessing the state immediately after calling setState() returns the existing value and not the updated one. As beginners in React, I’m sure most of us would have often faced this problem.

There is no guarantee of synchronous operation on setState() and calls may be batched for performance gains. It is easy to forget that the setState() is asynchronous, making it tricky for us to debug issues in your code. The setState() also does not return a Promise. Using async/await or anything similar will not work. …

About

Harsha Vardhan

Engineer, Photographer, Tech Blogger. Builds products and writes for developers. I love to code and love to help others code :)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store