Increase your day-to-day productivity with these commands

A quick overshare from my side. I worked on Windows during my college and my first professional job. Now, I moved from Windows to Linux for a project in my next job and I faced some issues.

Image for post
Image for post
Photo by Vlada Karpovich from Pexels

The transition was not effortless for me and it took me some time to move from using GUI (Big fan of GUI here 😉) to command line terminal. But after some time and of course some efforts, I become well versed with Linux command and terminal. Here are some of the basic commands which I wished I knew beforehand.

Open your Linux terminal and start typing these commands. …


An overview on how to set up your app for integration tests

In this article, we are going to discuss how we can write integration tests using Jest, Supertest and in process of writing integration tests, we often require mocking npm modules and dependencies, so we will also mock these npm modules and dependencies for smooth and complete testing.

Image for post
Image for post
Photo by Abet Llacer from Pexels

Let’s get started, Jest is an excellent library probably one of the best to write tests, check test coverage, mock modules, and is equipped with a lot of other useful features. First, we will create a Node.js application on which we can write tests.

In the above snippet, we are creating a simple application that will verify our access token. We will check for access token in our header and verify it using the jsonwebtoken library. Since we have not implemented JWT anywhere in our application, we will be using Jest Mock to mock the JWT NPM Module. …


In this article, we are going to take a look at how we can work with IndexedDB in TypeScript while working with a React application.

Image for post
Image for post
Photo by Stas Knop from Pexels

Let’s take a look at what is IndexedDB. IndexedDB is a low-level API for client-side storage of significant amounts of structured data, including files/blobs. This API uses indexes to enable high-performance searches of this data. While Web Storage is useful for storing smaller amounts of data, it is less useful for storing larger amounts of structured data.

IndexedDB is a transactional database system, like an SQL-based RDBMS. However, unlike SQL-based RDBMSes, which use fixed-column tables, IndexedDB is a JavaScript-based object-oriented database. IndexedDB lets you store and retrieve objects that are indexed with a key; any objects supported by the structured clone algorithm can be stored. You need to specify the database schema, open a connection to your database, and then retrieve and update data within a series of transactions. …


Infinite Scrolling — Infinite scrolling is a concept used by many sites to enhance user experience and performance. In infinite scrolling, the sites load with some data and as the user keeps on scrolling, more and more data gets loaded. This concept saves time since data is loaded in parts and enhance performance as all the components need not be rendered all at once.

Lazy Loading — Lazy loading is an optimization technique for online content,
Instead of loading the entire web page and rendering it to the user in one go as in bulk loading, the concept of lazy loading assists in loading only the required section and delays the remaining, until it is needed by the user. …


The world has shifted a long way from job seeker to job provider. The rise in startups make a good case for this shift.

To open a startup we all need a new idea which we believe that can bring a change, solve a problem, or maybe provide a better solution to what is already there. But, it’s not at all easy to get that idea — to get that inspiration to work for.

Image for post
Image for post
Photo by Helena Lopes from Pexels

Let’s discuss some of the coolest places and by places I also mean Internet from where you can get that idea and you probably visit some of the sites maybe everyday. So, let’s roll it out —

Y Combinator

Y Combinator provides seed funding for startups. Seed funding is the earliest stage of venture funding. It pays for your expenses while you’re getting started. Y Combinator has been an early investor in some of the biggest startups like Airbnb, Stripe, Dropbox, Docker.


How I implement JWT in cookie in the most secure way

I have read a number of articles on how to secure your JWT. The majority consensus is to store the JWT in cookie while some root for storing the JWT is local storage. I will try to implement JWT in cookie in most secure way according to me but feel free to point the potential bugs.

Image for post
Image for post
Photo by Designecologist from Pexels

I won’t be telling you how to make an app from scratch or something like that but if you want the complete thing, just comment and I will create a fully functional application on GitHub but for now let’s start.

Our application will be a simple one where a user would be logging in, since I am using a NoSql database, I will be using the _id which gets created automatically in the database to create the JWT for the user. …


Recently while solving a problem in LeetCode, I came across a problem where one part of the solution requires to add two very large integers, integers that max out the 53 bits size

Image for post
Image for post
Photo by Hasan Albari from Pexels

Since it was an integer with size more than 53 bits, it was not possible to add using the conventional method of using + operator. For me, I took a detour from the conventional method and add those two big numbers by converting them into strings.

The steps which I followed were —

  1. Converting those big numbers into a string.
  2. Making sure that both the strings have the same length by adding zeroes to the smaller string.
  3. Converting both strings into separate arrays of equal size.
  4. Iterating through the array in reverse order, adding one number from both the arrays and when the sum exceeds 10, adding value 1 to the carry and subtracting 10 from the sum just like we did in our primary classes. …


I was given a task where I was provided an array of URL’s and I had to download the contents of each URL and store in a file

Image for post
Image for post
Pexels.com

I don’t know whether anyone of you had faced this problem or not, but I recently had. I could have used promise and promise all or maybe. different npm modules. But, the problem was, the response was in streams.

So, JavaScript IMO is the world most modern complex language and it provided a solution for all our stuff. And for this kind of problem, JavaScript provided Closure to save our time and efforts. I used closure to get my task done and I am not saying that it’s the only solution or the best solution but it’s astonishingly a very good solution. …


Image for post
Image for post
Photo Credits: Pexels(Sirinda)

There is a war going on between JavaScript developers and one army is of Classical Inheritance and another army is of Object Composition. So, how do we make peace with it? The answer is simple, let’s program a game of football and whosoever you think programmed the game better will be the winner

Let’s play a game of penalty shootout where each player has 10 chances and the player can either hit or miss. With each hit, his goals scored tally would increase by 1, and miss would have no effect. …


Inline caching is a very less discussed topic in the field of JavaScript, yet it’s very important to write optimized code.

Before we start what is inline caching, we need to know why do we need inline caching. Yeah we need caching to speed up the things, we all know that. Okay, so next part is how inline caching came into play? Inline caching history dates as long back as Google V8 engine.

The first JavaScript engine, code named SpiderMonkey, was built for Netscape Navigator and was simply an interpreter that read and executed source code. In 2004, when Google introduced a new application; Google Maps. For JavaScript and developers everywhere it was a game changer. A very, very slow game changer. …

About

ANUPAM CHAUDHARY

I craft software that doesn’t irritate users. Lifelong learner. Full Stack developer with a thing for the front-end. Git- https://github.com/ANUPAMCHAUDHARY1117

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