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
// recursion | |
const recursiveSumInteger = (number) => { | |
if (number === 0) { | |
return 0; | |
} | |
return number + recursiveSumInteger(number - 1); | |
} |
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
// recursion 1 - using helper function | |
const RecursiveHelperSumArr = (arr) => { | |
let index = arr.length - 1; | |
// helper function | |
const recur = (curIndex, sum) => { | |
sum += arr[curIndex]; | |
if (curIndex === 0) return sum; | |
return recur(curIndex - 1, sum); // decrement the index and recursion | |
} |
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
// recursive | |
const recursiveOddOrEven = (number) => { | |
if (number === 0) { | |
return true; | |
} else if (number === 1) { | |
return false; | |
} else { | |
return recursiveOddOrEven(number - 2); | |
} | |
} |
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
// Things to go over | |
// 1 - mongodb (mongoose ORM) list of strings & default | |
// 2 - router middleware (koa) | |
// 3 - CRUD (with simple validation) write / read /remove / update | |
////\\\\ | |
// models/post.js | |
////\\\\ | |
const mongoose = require('mongoose'); |
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
// things to go over | |
// 1 - IntersectionObserver why it is being loaded (rendering 20 players at a time vs. lazy loading) | |
// 2 - lazy loading using `lazy` classname | |
async componentDidMount() { | |
this.handleScroll(); | |
} | |
handleScroll = () => { | |
const lazys = document.querySelectorAll('.lazy'); |
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
// want to go over | |
// 1 - use of functional components | |
// 2 - dynamic component `component :is` | |
<template functional> | |
<header | |
:class="[ | |
`${props.blockName}__text-head`, | |
{'gls-download-content__text-head--no-msg': | |
props.blockName === 'gls-download-content' && !props.commentMessage}]" | |
> |
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
<docs> | |
- share-success-root-wrapper | |
-- This class is to hide custom blur overflow from overlay-scrollbars modal | |
</docs> | |
// want to go over | |
// 1 - use of overlay-scrollbars | |
// 2 - use of `named slot` | |
// 3 - dynamic classname | |
// 4 - native SVG components |
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
// chunkUpload | |
// uniformChunkRequest | |
// partialChunkRequest | |
// chunkRequestHelper | |
// want to go over | |
// 1 - uniform & partial upload (why there are 2 different functions) | |
// 2 - use of `chunkRequestHelper` function to send headers & body (formData) | |
// 3 - chunkStar & chunkEnd - how it's being calculated `chunkStart + CHUNK_SIZE > fileClone.size` |
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
// want to go over | |
// 1 - use fo constants | |
// 2 - cancelToken | |
// 3 - progress upload + how `numberOfRequests` is being used to represent the multiple requests | |
// 4 - `uploadFileResponseHelper` & `uploadFileErrorHelper` helper functions | |
// constants/file.constants.js | |
const CHUNK_SIZE = 1000 * 1000 * 100; // 100mb |
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
// ASSUMPTION | |
// text files will be placed in the same directory as the program file | |
// Question | |
// is the word case-insensitive? not specified in the problem statement | |
// so in the code below, I take care of each words as case-insensitive e.g.) so & So are the same words | |
// HOW TO RUN PROGRAM | |
// node <file_name> <sampleFile> <commonFile> | |
// for example, node test.js alice_in_wonderland.txt 1-1000.txt |