Writing and singing 2 lines

Today after coming back from office, I sat down down for having dinner. but my heart was to rhyme something. I took a notebook and write 2 lines that was playing in my mind constantly. After writing, i tried to record it. I know, i am bad at singing but i love to do what my heart says. So rhyme these 2 lines. By the way, these lines are in Punjabi language. So hardly anyone will be able to understand it….ha ha!! This is it for now. I am thinking of extending it to some lines. But will do that …

Continue Reading

How to write custom logging function in JavaScript

In this article we will be discussing, how to write custom logging function in JavaScript. Javascript provide various logging function by default like:

Why Custom Logging: But there are various instances when you would like to have custom logging function. Some of these instances might be like : Logging messages based on components basis(Each logging message have component name prefixed). Enable/disable logging with a flag, e.g., isDebug = true i.e You might want to have logs while development while no logs for production environment. Short logging syntax i.e logs(“Hello world”);   Above are just some common example in case …

Continue Reading

How to add comments in JSX

In this article i will be discussing what is JSX, JSX in React and how to add comments in JSX template. What is JSX: JSX is an XML/HTML-like syntax used by React that extends ECMAScript so that XML/HTML-like text can co-exist with JavaScript/React code. The syntax is intended to be used by preprocessors (i.e., transpilers like Babel) to transform HTML-like text found in JavaScript files into standard JavaScript objects that a JavaScript engine will parse. Basically, by using JSX you can write concise HTML/XML-like structures (e.g., DOM like tree structures) in the same file as you write JavaScript code, then …

Continue Reading

How to add class in react conditionally

During initial day of react coding, all of us must stuck with the question how to add class in react conditionally. One often requires to add class in react DOM element based on some condition. Adding cladd using conditional operator is an very easy way to add class in react conditionally like this.

  In above code, hide class will be added when this.state.showLoading value will be set to false.  

Continue Reading

How to calculate the executing time of Javascript code

Are you looking out for the way using which you can get the executing time of Javascript code? Around the javaScript community i have seen people using various methods to achieve the same. Today i will discus various of them and also discuss which one is the better one and why.   Use Cases: There are a few situations where you’d use this high resolution timer instead of grabbing a basic timestamp: Benchmarking game or animation runloop code Calculating frame rate with precision Cueing actions or audio to occur at specific points in an animation or other time-based sequence Let’s …

Continue Reading

A fresh start of Life

My life was very smooth & happy a year back and within a year i had lost everything i had. Love, money, inspiration, self image and everything i had. I made terrible mistakes, even try hard to fix some of things & lost in black hole of my thoughts. Now i left with nothing. Yesterday i was sitting in my house holding my head full of pain. For a time being it feels like i got so much burden on my head and no string is left to pull off now. Honestly speaking, i even got life ending thoughts.   …

Continue Reading