Promises and Error Handling

What is promise? Promise provide us an alternative approach of asynchronous operation which is clean, more readable and flexible when compared to traditional callback-based approaches. It is very useful when we chain multiple async operation and after that we do…

Read More »

Git cheat sheet and practical uses

This cheat sheet summarizes commonly used Git command line instructions for quick reference Story 1:  What will we do when we have to work on a new features/ new work? First, we need to checkout master branch “$git…

Read More »

Tips to Add Tooltip to Select2

How to add tooltip in select2 When selected text is long in select2, then it does not show the full text. So, it is very difficult to understand what is selected. For the above problem we can solve…

Read More »

Temporal dead zone (TDZ) and the Deathly Hallows

What is TDZ in javascript? Temporal dead zone is the period between entering scope and being declared where they cannot be accessed. An example will give it clear the concept of TDZ. So, for example- accessDenied = ‘can not…

Read More »

git cherry-pick

What is git cherry-pick In git, Cherry picking means to choose a commit from one branch and apply it onto another. Basic Syntax: git cherry-pick <commit-hash> Cherry picking will merge the specify commit to your current checkout branch. When…

Read More »

Circular dependencies in Node.js

What is cyclic/ circulardependencies in nodeJs When required a module and we got {} instead. Suppose, we have the following code // moduleA.js var ModuleB = require(‘./moduleB.js’); var ModuleA = function() { this.bInstance = ModuleB(); this.property = 10;…

Read More »

Robots.txt

What is Robots.txt Robots.txt (also known as the robots exclusion protocol or standard) is used to allows a website to provide instructions to web crawling bots. What is inside Robots.txt The robots.txt file contains a set of instructions…

Read More »

Using Sinon to stub Mongoose calls and return Promise

Suppose we have a schema var User = require(‘./schemas/UserSchema’).User; and we want to write unit test for like bellow code: var getUserById = function () { return User.findOne({_id: ‘001’}).exec(); }; Before writing unit test we can mock the…

Read More »

Mongodb Full Text Search

MongoDB Full Text Search MondodDB full text search is used to search text content. Text Search uses Text Index and $text operator to perform its operation. Why we need Full Text Search First, we need to know why and when…

Read More »

Mongodb Map-Reduce

Mongodb Map-Reduce Map-reduce is a data processing paradigm for condensing large volumes of data into useful aggregated results. In this map-reduce operation, MongoDB applies the map phase to each input document (i.e. the documents in the collection that…

Read More »