Skip to content

Instantly share code, notes, and snippets.

@pmayur
pmayur / npm.md
Last active January 2, 2021 14:19
NPM - Sameer Buna

Install package from the github repository

Installs directly from the latest version of the repository upto the latest commit

npm i <package-name>/<repo-name>

npm i express/express
@pmayur
pmayur / understanding_this.md
Created January 6, 2021 19:34
Understanding this in constructor functions vs regular functions

Understanding calling of this in Javascript

Consider the following function

function Person(name) {
	this.name = name;
	return this;
@pmayur
pmayur / resources.md
Created January 9, 2021 18:53
Resources to understand Javascript advanced concepts

GIT COMMANDS

$ git reset --hard HEAD

move to head

$ git reset --hard <branch-name>

move to branch

@pmayur
pmayur / converting_js_to_ts.md
Last active September 15, 2021 12:42
converting js to ts

Converting JS to TS

  • Perform tsc --init in the repo for initiating a tsconfig.json file
  • Edit tsconfig.json config as per required
  • Use the following scripts to convert js files to ts one by one
find app/src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
  • Use the following script to add // @ts-nocheck comment on top of all ts files to avoid immediate ts errors or don't convert them to ts
@pmayur
pmayur / vimeo-downloader.js
Created October 13, 2021 14:16 — forked from mistic100/vimeo-downloader.js
Download video from Vimeo (chopped m4s files)
// 1. Open the browser developper console on the network tab
// 2. Start the video
// 3. In the dev tab, locate the load of the "master.json" file, copy its full URL
// 4. Run: node vimeo-downloader.js "<URL>"
// 5. Combine the m4v and m4a files with mkvmerge
const fs = require('fs');
const url = require('url');
const https = require('https');