sahilrajput.com

Sahil Rajput

A crazy spirit
Exercise Routines, Dhyaan/Meditation, Music & Visuals, Blog Recommendations, Vocab Doc (web, local), Lifestyle
JS CheatSheet, MacOS Vscode Shortcuts, Unit Conversions, Transcribe/Convert/Download, English/Hindi Typing Courses
Website: sahilrajput.com
Github: github.com/sahilrajput03/sahilrajput03
Play Store: Tech Blog by Sahil Rajput

🥕🍎 In command ts-node-dev --transpile-only tg.ts what does the flag do --transpile-only? (ChatGPT)

The --transpile-only flag in the ts-node-dev command tells TypeScript Node (ts-node) to skip type checking when running the TypeScript code. Normally, TypeScript checks the types as it compiles the code, which can slow down the process.

When using --transpile-only, TypeScript only transpiles the code (i.e., converts TypeScript to JavaScript) without performing any type checks. This can make the development process faster, especially in situations where you rely on external tools (like an IDE or a separate build step) to handle type checking.


ॐ सर्वे भवन्तु सुखिनः			Om Sarve Bhavantu Sukhinah)			- Om, May All be Happy,
सर्वे सन्तु निरामयाः । 			Sarve Santu Niraamayaah) 			- May All be Free from Illness.
सर्वे भद्राणि पश्यन्तु 			Sarve Bhadraanni Pashyantu)			- May All See what is Auspicious,
मा कश्चिद्दुःखभाग्भवेत् । 		Maa Kashcid-Duhkha-Bhaag-Bhavet)		- May no one Suffer.
ॐ शान्तिः शान्तिः शान्तिः ॥ 		Om Shaantih Shaantih Shaantih)			- Om Peace, Peace, Peace.
echo Hello world! > /dev/null
cat /dev/null
!!(() => {})

Javascript Cheatsheet - Sahil

SLEEP FUNCTION
==============
await new Promise(r => setTimeout(r, 2000))


SLICE Array Method
==================
// Note:
// 1. slice() method returns shallow copied array.
// 2. first argument is inclusive and second argument is **non-inclusive**
const newArray = myArray.slice(startIdx, endIdx + 1);



SORTING Array Method
=======
myNumbers.sort(); // sorts in ascending order [DEFAULT]
myNumbers.sort((a, b) => a - b); // sorts in ascending order [DEFAULT]
myNumbers.sort((a, b) => b - a); // sorts in descending order



REDUCE ARRAY METHOD
======
ar = [ 1, 2, 3 ]
ar.reduce((a,b) => a+b, 0) // Output: 6



PUSH/POP/SHIFT/UNSHIFT - all mutate array
=====
`push` and `pop` works on end of array
`unshift` and `shift` works on start of array



USING FETCH
===========
// client-side
const response = await fetch('/roll'); // 'GET'
const { number } = await response.json();

const response = await fetch('/todo', {
	method: 'POST', // 'PUT', 'DELETE', 'PATCH'
	body: JSON.stringify({ description }),
	headers: {
		'Content-Type': 'application/json'
	}
});
const { description } = await response.json();

// server-side
const { description } = await request.json();



GETTER AND SETTERS IN AN OBJECT
===============================
// Example 1:
const obj = {
    countValue: 42,
    get count() {
        return this.countValue;
    },
    set count(value) {
        this.countValue = value;
    }
};

console.log(obj.count); // 42
obj.count = 43;
console.log(obj.count); // 43




// Example 2:
let input = {
    a: 1,
    b: 2,
    get sum() {
        return input.a + input.b;

    }
};

console.log(input.sum); // 3

input.a = 3;
input.b = 4;
console.log(input.sum); // 7




// Example 3:
function add(input) {
    return {
        get value() {
            return input.a + input.b;

        }
    };
}

let input = { a: 1, b: 2 };

let total = add(input);
console.log(total.value); // 3

input.a = 3;
input.b = 4;
console.log(total.value); //7




// WHEREAS FUNCTION DEFINED WITH `function` KEYWORD OR ARROW-FUNCTION-SYNTAX BEHAVES HAS GENERAL FUNCTIONS UNLIKE GETTER/SETTERS:
// -----------------------------------------------------------------------------------------------------------------------------
// Read more differenes here - https://github.com/sahilrajput03/sahilrajput03/blob/main/learn-js.md#geeter-setters-in-object
const obj = {
  countValue: 42,
  count: () => this.countValue, // Note: `this` here doesn't refer to the object.
};

console.log(obj.count()); // undefined, because `this` does not refer to `obj`.



~~
===============================
// In JS, the ~~ symbol is often referred to as the double tilde. It is a shorthand trick for converting a number to an integer by dropping its decimal part (similar to Math.floor() for positive numbers). ~~ relies on bitwise operations, which are implemented at a lower level in JavaScript. Using ~~ is limited to 32-bit signed integers. For usage with any numeric value please prefer using `Math.trunc()` instead. (from ChatGPT)
console.log(~~4.5);    // Output: 4
console.log(~~-4.5);   // Output: -4

Online Markets I use:

Public Clipboard: Click here

Superscript Numbers: ⁰¹²³⁴⁵⁶⁷⁸⁹

Unit Conversions

Tags: #metre, #foot, #feet, #centimeter

A small scale is 15cm long.

Length 			
======
1 ft ≈ 30.48 cm
1 m ≈ 3.3 ft (precisely 3.28084)
1 m ≈ 39.4 inch (precisely 39.3701)
1 km ≈ 0.62 miles (precisely 0.621371)
1 mile ≈ 1.61 km (precisely 1.60934)

10^⁶ = 1 Million = 10 Lakh
10^⁹ = 1 Billion = 100 Crore
10^¹² = 1 Trillion = 100k Crore  =  100 Thousand Crore  =  1 Lakh Crore

Mass
====
1 kg ≈ 2.2 lbs (pounds)
1 lbs ≈ 0.45 kg

Currency
========
**For fastest conversion from dollar to inr you can simply multiply by 100 (~84 ₹/$).**

$ to ₹ Conversion factor: 83 ₹/$
₹ to $ Conversion factor: 0.012 $/₹

$ 1 Million  = ₹ 8.3 Crore
$ 1 Billion  = ₹ 8.3k Crore
$ 1 Trillion = ₹ 83 Lakh Crore = ₹ 8300k Crore

Conversion Trick For $ and ₹
============================
1. To convert $ to ₹ we can multiply the value with 10 and 8 in sequence. (Refer ^1 at bottom)
2. To convert ₹ to $ we can divide the value with 10 and 8 in sequence (Refer ^1 at bottom)

References
==========
^1: 10 and 8.3 are multiplicative factors of 83 because 10 x 8.3 equals 83.

What is Selling?

Source: Click here

PEU:

Royal Society Prizes for Science Books

Breath by James Nestor is the finalist for the year 2021.

Click here

Breathing Videos by James Nestor

❤️ Breathing Videos: Click here

❤️ Interesting Page of James Nestor - Wikipedia: Click here

Document Order & Titles Notice for Google Docs

social-media-game

Superprof .co.in: Click here

Indiamart .com: Click here

English and Hindi Typing Courses

Note: Mangal is part of the Unicode standard, which means it supports a wide range of Devanagari characters and is more compatible with modern software and devices.

❤️ Note: Learn Typing on Mobile: Click here)

Proxy Sites of Torrent Sites

Source: Click here (earlier sitenable.com)

Tech Journal & Blogging: Click here | Old feed

General Blogging: Click here

English Channels in India

Source: List of English-language television channels in India | Wikipedia: Click here

Trademarks: OneUniverse, Same Roof

Sahil’s Vocabulary 🚶: Click here | Doc

Transcribe, Convert, Download

❤️ 🫁 Reset Immune System - Wim Hof Method & Breathwork (Doc)

Note: Wim Hof Breathing or Breathe With Sandy are modern versions of Tummo Breathing.

Practices

*bc = breath cycle

Why Wim Hoff breathing?

It’s gonna boost both your immune system and calmness in a compound effect each day throughout life.

Business Apps

Depressions & Mental Health Support

Be Productive with videos 📽️ 🎬

Original & Curated Articles

Continents

Source: Continent - Wikipedia: Click here

Quick Links:

More:

References:

Made using Jekyll Template - abhinavs/moonwalk