Skip to content

Instantly share code, notes, and snippets.

View rhnmht30's full-sized avatar
🏠
Working from home

Rohan Mehta rhnmht30

🏠
Working from home
View GitHub Profile
@rhnmht30
rhnmht30 / JavaScript Members Not Bound to Instances.md
Created January 23, 2023 20:15 — forked from dfoverdx/JavaScript Members Not Bound to Instances.md
Why JavaScript class members are not automatically bound to the instance of the class

It took a few years, but I finally understand why member functions of classes in JavaScript aren't automatically bound to their objects, in particular when used in callback arguments.

In most object-oriented languages, functions are members of a class--they exist in memory only once, and when they are called, this is simply a hidden argument of the function which is assigned to the object that's calling it. Python makes this explicit by requiring that the first argument of a class's member function be self (Python's equivalent of this--you can name self whatever you want, but self is the convention).

class MyClass:
#!/usr/bin/env bash
echo "
----------------------
NODE & NPM
----------------------
"
# add nodejs 12 ppa (personal package archive) from nodesource
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
@rhnmht30
rhnmht30 / README.md
Last active April 4, 2020 13:38
A small tweak to convert webp to png downloaded from manga rock on android. This method is for the linux users as it uses webp package.

Steps to generate PNGs from WEBPs downloaded with Manga Rock

  • Create a folder with all the copied content from Android/data/manga_rock_system_folder/files
  • Install the converter with this cmd: sudo apt-get install webp
  • Open the folder in the terminal, by right clicking there and selecting the open the terminal option.
  • Create an index.js file. (Code given in this gist)
  • Run touch index.js.
  • Run gedit index.js, a text editor opens for you to copy the below code.
  • Run node index.js
  • Sit back and Relax!