life is too short for a diary

Dear Vishi, daily logs for May 7, 2023

Tags: diary letters

Dear Vishi, this is my daily log for May 7, 2023.


I am still having jetlag I guess. I sleep at 3 am and wake at 8 am. It's been almost a week. There is hilarious quote about sleep

"Dear sleep, I’m sorry we broke up this morning. I want you back!" — Anonymous

I like to collect quotes and keep a personal collection.

Passport from US Embassy

I had applied for dropbox stamping on May 1, 2023. I am still waiting for my passport. More than a week has passed. I made a foolhardy plan to only give 2 week buffer before boarding my flight. Hope the passport comes on time.

30 Days of LC Javascript challenge

There is a 30 day challenge hosted at leetcode.

Apply Transform Over Each Element in Array

Given an integer array arr and a mapping function fn, return a new array with a transformation applied to each element.

Input: arr = [1,2,3], fn = function plusone(n) { return n + 1; }
Output: [2,3,4]

The solution is straightforward to use map

var map = function(arr, fn) {

Create Hello World Function

Write a function createHelloWorld. It should return a new function that always returns "Hello World".

Input: args = []
Output: "Hello World"


var createHelloWorld = function() {
  return function(..args) {
    return "Hello World"


Given an integer n, return a counter function. This counter function initially returns n and then returns 1 more than the previous value every subsequent time it is called (n, n + 1, n + 2, etc).

const counter = createCounter(10)
counter() // 10
counter() // 11
counter() // 12


var createCounter = function(n) {
    return function() {
        return n++;

This is a simple example of using closures in javascript.

  1. Closure are nested function which has access to the outer scope

  2. After the outer function is returned, by keeping a reference to the inner function (the closures) we prevent the outer scope to be destroyed.

SonarQube exclude directories

Sometimes you want to skip certain folders for scanning. Add following option to the config


Top Gun movie

I watched it today. It was in my bucket list. I liked the soundtrack and visual effects. I guess story could have been more captivating.


I am currenlty reading ng-book

Create a new project

$ ng new angular-hello-world

In the file angular-hello-world/src/index.html

<app-root> </app-root>

the app-root is where application is rendered. It's a component.

To run the application, go to localhost:4200

$ ng serve --port 4200

Create a component

$ ng generate component hello-world

Component consist of two parts

  1. a component decorator

  2. a component definition class

Open the file angular-hello-world/src/app/hello-world/hello-world.component.ts

import {Component, OnInit} from '@angualar/core';

    selector: 'app-hello-world',
    templateUrl: './hello-world.component.html',
    styleUrl: ['./hello-world.component.css']

export class HelloWorldComponent implements OnInit{
  constructor() {}


@Component is the decorators. In the angular-hello-world/src/app/app.component.html, we can use


I am tracking my books here

comments powered by Disqus