This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// assuming el is dom object | |
function checkVisible(el) | |
{ | |
return el.offsetTop < window.innerHeight + window.pageYOffset | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const quickSort = list => { | |
if (list.length < 2) | |
return list; | |
let pivot = list[0]; | |
let left = []; | |
let right = []; | |
for (let i = 1, total = list.length; i < total; i++){ | |
if (list[i] < pivot) | |
left.push(list[i]); | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/(.*?)/g | |
// (.*?) is ungreedy |
OlderNewer