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 adjustPaddings = isScrollDown => { | |
| const container = document.querySelector(".cat-list"); | |
| const currentPaddingTop = getNumFromStyle(container.style.paddingTop); | |
| const currentPaddingBottom = getNumFromStyle(container.style.paddingBottom); | |
| const remPaddingsVal = 170 * (listSize / 2); | |
| if (isScrollDown) { | |
| container.style.paddingTop = currentPaddingTop + remPaddingsVal + "px"; | |
| container.style.paddingBottom = currentPaddingBottom === 0 ? "0px" : currentPaddingBottom - remPaddingsVal + "px"; | |
| } else { | |
| container.style.paddingBottom = currentPaddingBottom + remPaddingsVal + "px"; |
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 recycleDOM = firstIndex => { | |
| for (let i = 0; i < listSize; i++) { | |
| const tile = document.querySelector("#cat-tile-" + i); | |
| tile.firstElementChild.innerText = DB[i + firstIndex].title; | |
| tile.lastChild.setAttribute("src", DB[i + firstIndex].imgSrc); | |
| } | |
| } |
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 initIntersectionObserver = () => { | |
| const options = { | |
| /* root: document.querySelector(".cat-list") */ | |
| } | |
| const callback = entries => { | |
| entries.forEach(entry => { | |
| if (entry.target.id === 'cat-tile-0') { | |
| topSentCallback(entry); | |
| } else if (entry.target.id === `cat-tile-${listSize - 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
| /* jshint esversion: 6 */ | |
| // Solve the following prompts using recursion. | |
| // 1. Calculate the factorial of a number. The factorial of a non-negative integer n, | |
| // denoted by n!, is the product of all positive integers less than or equal to n. | |
| // Example: 5! = 5 x 4 x 3 x 2 x 1 = 120 | |
| // factorial(5); // 120 | |
| var factorial = function(n) { | |
| if (n < 0) return null; |
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
| // ['w','h','a','t',' ','o','n',' ','e','a','r','t','h',' ','a','r','e',' ','y','o','u',' ','t','a','l','k','i','n','g',' ','a','b','o','u','t','?'] | |
| function isVowel(x) { | |
| var result; | |
| result = x === "a" || x === "e" || x === "i" || x === "o" || x === "u"; | |
| return result; | |
| } | |
| function doubleV(array) { |
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
| var CashAmount = function(val) { | |
| val = val.toFixed(2) | |
| this.value = val; | |
| } | |
| CashAmount.prototype.totalInPennies = function() { | |
| var array = this.value.split('.'); | |
| var first = array[0] + '00'; | |
| return parseInt(first) + parseInt(array[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
| var path = require('path'); | |
| module.exports = { | |
| entry: path.resolve(__dirname, 'src') + '/app/index.js', | |
| output: { | |
| path: path.resolve(__dirname, 'dist') + '/app', | |
| filename: 'bundle.js', | |
| publicPath: '/app/' | |
| }, |
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
| var path = require('path'); | |
| module.exports = { | |
| entry: path.resolve(__dirname, 'src') + '/app/index.js', | |
| output: { | |
| path: path.resolve(__dirname, 'dist') + '/app', | |
| filename: 'bundle.js', | |
| publicPath: '/app/' | |
| }, |
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
| /** | |
| * @param {number} numRows | |
| * @return {number[][]} | |
| */ | |
| var generate = function(numRows) { | |
| if (numRows === 0) { | |
| return []; | |
| } | |
| if (numRows === 1) { | |
| return [[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
| /** | |
| * @param {number} numRows | |
| * @return {number[][]} | |
| */ | |
| var generate = function(numRows) { | |
| var result = []; | |
| result[0] = [1]; | |
| result[1] = [1,1]; | |
| for (var row = 2; row < n; row++){ | |
| result[row] = [1]; |