Skip to content

Instantly share code, notes, and snippets.

View nodeEnthu's full-sized avatar

Gautam Mehra nodeEnthu

View GitHub Profile
@nodeEnthu
nodeEnthu / merge sorted linked lists
Created May 1, 2020 18:14
description to merging sorted linked lists
var mergeTwoLists = function(l1, l2) {
const newNode = new ListNode(-1);
function mergeTwoListsRec(newL1Head, newL2Head, prevHead) {
if(!newL1Head || !newL2Head) {
prevHead.next = (newL1Head || newL2Head);
return;
}
@nodeEnthu
nodeEnthu / VisibleArea.js
Created December 13, 2019 20:54
callback for intersection observer
intersectionCallback(entries, observer) {
const self = this;
entries.forEach(entry => {
if(entry.isIntersecting) {
// append the current row in visible area
const divToAppendReactElement = document.createElement('div');
divToAppendReactElement.id = `dom${this.currentScrollPosition}`;
const newElement = ReactDOM.render(self.configureInsertedElement(), divToAppendReactElement);
const parentNode = entry.target.parentNode;
const target = document.getElementById(`end-sentinel${this.currentScrollPosition}`);