Skip to content

Instantly share code, notes, and snippets.

View AdarshKonchady's full-sized avatar
🐶
Working on Web stuff !

Adarsh Konchady AdarshKonchady

🐶
Working on Web stuff !
View GitHub Profile
@AdarshKonchady
AdarshKonchady / vscode-js-debug-configuration.json
Created August 24, 2021 04:51
VSCode JS debug configuration
"launch": {
"inputs": [],
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Current Opened File",
"program": "${file}"
}
],
@AdarshKonchady
AdarshKonchady / inheritance2.js
Created January 21, 2019 05:39
inheritance2.js
function Animal() {
this.offspring = [];
}
function Dog() {
Animal.call(this); // Use Animal.call(this, args) if any arguments
// exist. Else, use 'apply'
}
Dog.prototype = Object.create(Animal.prototype);
Dog.prototype.constructor = Dog;
var d1 = new Dog();
@AdarshKonchady
AdarshKonchady / inheritance1.js
Created January 21, 2019 05:38
inheritance1.js
function Animal() {
this.offspring = [];
}
function Dog() {
}
Dog.prototype = new Animal();
Dog.prototype.constructor = Dog;
var d1 = new Dog();
var d2 = new Dog();
var pup = new Dog();
@AdarshKonchady
AdarshKonchady / isInViewport.js
Last active January 21, 2019 05:27
isInViewport
function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
if (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
) {
return true;