learn
Using Nullish Coalescing Operator
· ☕ 6 min read
ES2020 introduced nullish coalescing operator. We will see just how and where can you find use for it? What it is? Nullish coalescing operator (??) is introduced in the newest Javascript specification. It’s primary design goal is quite simple - provide a way to check for nulls to return true or false values from an expression.

Javascript - A Beginner Guide
· ☕ 30 min read
Here’s a good guide to get you started on Javascript in a practical way. Why another guide? Practical - don’t learn for the sake of learning, learn for the sake of doing! Tactical - learn what matters, fast (yes, that’s what everyone says) Strategic - see the big picture This guide will get you started from the beginning, graduate you to using industry standard tools, and point you towards the right direction for learning even more than what can be offered in one guide or course.

A quick start on ASP.NET Core Razor Pages
· ☕ 8 min read
Here’s a quick introduction to Razor pages in ASP.NET core, and an opinionated way to quickly start building applications using Razor pages. And yes, there is a case for using Razor pages even in 2020. So.. ASP.net? Yes, indeed. I have had a love-hate relationship with ASP.NET through years. I am way less productive using ASP.

Reusable debounce function for Vue
· ☕ 5 min read
Debounce operations in Vue using this 10 line script. Avoid loadash and friends. What is debounce? Delay and throttle operations to wait and collect user input before doing something with the input. The “something” can be updating another field, doing an API call, or starting a timer to self-destruct. Did you not debounce earlier?

Centralized alert for Vuetify
· ☕ 4 min read
Centralize all error, warning and info alerts in one place. I like v-alert and tend to over-use it. It enables us to show detailed notifications (error or otherwise) - without significantly causing user inconvenience. I find v-alert more suitable in my apps than using, say, popup alerts that interrupt users, or “toast” notifications which I find unsuitable for detailed messages.

Asserts are not just for testing
· ☕ 2 min read
Assert is a general-purpose validator and should not be used in the context of testing alone. An assert in Javascript simply checks for truthy values and produces an error otherwise. We use it quite a bit in automated testing when checking for correctness of output for pre-defined inputs. We use asserts like so -

Three quick ways to convert objects to arrays
· ☕ 2 min read
Easily convert objects to arrays and iterate to your heart’s content. There are multiple ways of converting an object to an array (which, also is an object but a different one at that.) Method 1: A simple Object.values() method The first idea that comes to mind is to just use Object.

A Different IIFE Syntax
· ☕ 1 min read
Here’s a different syntax for our favourite IIFE’s. Immediately invoked function expressions enable us to write functions without using “functions”. Well - just kidding. They are functions but with a different syntax. A typical IIFE looks like this - 1 2 3 4 5 6 7 8 9 10 11 const x = 1, y = 9; var sum = 0; (function() { sum = x + y; console.

Conditionally copy props to new object in Javascript
· ☕ 2 min read
Here’s a shorter, readable way to copy props from one object to another subject to defined conditions. The shortest way to copy object (when you don’t quite care about copying sub objects by reference) - 1 2 3 4 5 const planet = { name: "earth", position: 3 }; const newPlanet = { .

A simpler curry for Javascript
· ☕ 1 min read
A simpler way to do curry functions in Javascript. We have previously seen currying in Javascript. A simple form and application of that concept is demonstrated below - 1 2 3 const addThem = add.curry(2); const addTotal = addThem(1); console.log("addTotal: ", addTotal); // 3 Or, we could avoid a external function or library and curry using bindings .

Implicit return gotcha for arrow functions
· ☕ 2 min read
Beware of using implicit returns in arrow functions. Consider the below example of a simple arrow function. It returns a simple variable. In the absence of any other statement in the function body, a simple mention of x will return the value of x. 1 2 3 const getStuff = x => x; console.

Use onclick event instead of 'submit' in Javascript
· ☕ 2 min read
Use onclick rather than submit in HTML forms. A typical HTML form has a few fields and a button to submit the data to some back-end server. And, the typical way to do the form submission is through the submit method. 1 2 3 4 5 <form action="/helloMessage.php"> <input type="text" id="name" /><br /> <button type="submit"></button> </form> On clicking the button, the page will submit data to helloMessage.

Print a page section on button-click in Vue
· ☕ 2 min read
Use a button on a Vue component to start a print dialog and print a specific section. Setup We will use a small library called ‘html2paper’. First install the said library in your Vue project - 1 npm install vue-html-to-paper Add library to your code in main.js -