This file contains 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 Cashinator3000 = (priceList, startingAmount = 0, salesTax = 0.0725) => { | |
this.priceListCSV = priceList; | |
this.startingAmount = startingAmount; | |
this.salesTax = salesTax; | |
this.transactions = []; | |
this.transactionId = 0; | |
}; | |
Cashinator3000.prototype.currentBalance = () => { | |
return this.startingAmount; |
This file contains 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
//Testing the last 1 million records to effectively assess the caching | |
//Best RPM = 53.2k | |
//Redis strategy = --maxmemory 512mb --maxmemory-policy allkeys-lru | |
const siege = require("siege"); | |
const randomNumbers = []; | |
const random = (min, max) => Math.floor(Math.random() * max) + min; | |
const arrSize = 150000; | |
for (let i = 0; i < arrSize; i += 1) { |
This file contains 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
5000000 | room5000000 | North Anthonyfort | Apartment | Quasi qui ut libero molestias. | 1 | 1 | 3 | 4 | Dr. Delmer O'Hara | https://s3.amazonaws.com/uifaces/faces/twitter/panchajanyag/128.jpg | In illum enim ad quibusdam nulla ea. Amet dolores molestiae libero dolore dolor voluptatem rerum. Voluptas accusamus ut est deserunt laudantium necessitatibus. | Quis placeat in qui consectetur perferendis ut est aut. Recusandae cum a dolor sunt deserunt numquam nam est. | Animi cum aut quidem dolore et fugiat. | Eum laboriosam dolor. Quia quia veniam necessitatibus.* Quas omnis repudiandae porro quia. Accusamus esse nam ut laborum aut sed. Deleniti eos eum modi alias. Amet non repellat iste enim modi illum minima itaque. Exercitationem placeat voluptatem tempore quaerat praesentium aliquid in qui. | Harum et vel. Minima omnis adipisci quas.* Quia aut sed et quia ratione laboriosam eos. Consectetur deleniti qui eos aut et.* Ut aut aliquam ut perferendis numquam. Molestias ut velit soluta modi ani |
This file contains 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
//input = array of individual chars. | |
//ouput = same array with double the amount of vowels. | |
const doubleVowels = array => { | |
for (let index = array.length - 1; index >= 0; index--) { | |
if (checkForWowels(array[index])) { | |
array.splice(index, 0, array[index]); | |
index--; | |
} | |
} |
This file contains 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
/** | |
* Definition for a binary tree node. | |
* function TreeNode(val) { | |
* this.val = val; | |
* this.left = this.right = null; | |
* } | |
*/ | |
/** | |
* @param {TreeNode} root | |
* @param {number} k |
This file contains 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
//Reacting start API Call | |
componentDidMount () { | |
let path = window.location.pathname; | |
path = path.split('/')[2]; | |
const self = this; | |
axios.get(`/api/restaurant/${path}`) | |
.then((response) => { | |
self.setState({ | |
data: response.data, | |
loaded: true, |
This file contains 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
// Problem case with floating-point arithmetic: 0.10 + 0.20 !== 0.30 | |
// But for us, should be: 0.10 + 0.20 === 0.30 | |
function CashAmount (amount) { | |
this.amount = amount; | |
}; | |
CashAmount.prototype.totalInPennies = function() { | |
const result = this.amount * 100; | |
return result; |
This file contains 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 findLargestLevel = function(n) { | |
//first create a holder var | |
const allNodes = []; | |
// define our recursive foo (node, depth) | |
function checkNodes (node, depth) { | |
// first add the value of the node to its current depth (in the array) | |
if (!allNodes[depth]) { | |
allNodes[depth] = 0; | |
} |