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
//Create array | |
const arr = []; | |
for(let i = 0;i < 10;i++){ | |
//Fill array with random values between 1 and 50 | |
arr.push(Math.floor(Math.random() * 50) + 1) | |
} | |
//Display array | |
console.log(arr) | |
//Prompt user for input | |
const num = prompt('Enter number') |
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
function weightedUniformStrings(s, queries) { | |
const count = (string) => string.split('').reduce((acc,letter,index) => { | |
if(!acc[letter]){ | |
acc[letter] = [1] | |
}else{ | |
if(string[index - 1] && string[index - 1] === letter){ | |
acc[letter][acc[letter].length - 1] += 1 | |
}else{ | |
acc[letter].push(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
const getDistanceFromTop = (element,current = 0) => element.parentElement ? getDistanceFromTop(element.parentElement,element.offsetTop + current) : current; | |
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 makeRequest = async (method,url, body = null) => new Promise((resolve,reject) => { | |
const request = new XMLHttpRequest(); | |
request.addEventListener('load',() => resolve(request)); | |
request.addEventListener('error',() => reject(request)); | |
request.open(method,url); | |
request.send(body); | |
}); |
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 link = document.createElement('a'); | |
link.href = "file url"; | |
link.download = 'file name'; | |
document.body.appendChild(link); | |
link.click(); | |
link.remove(); |
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
config.module.rules.find( | |
rule => rule.test.toString() === '/\\.css$/', | |
).exclude = /\.module\.css$/; | |
config.module.rules.push({ | |
test: /\.module\.css$/, | |
use: [ | |
'style-loader', | |
{ |
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
export const classNames = (...classes) => | |
classes.filter((className) => className).join(" "); |
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
function doGet(e){ | |
return handleResponse(e); | |
} | |
var SCRIPT_PROP = PropertiesService.getScriptProperties(); // new property service | |
function queryToObject(query){ | |
return query.split('&').reduce(function (acc,curr){ | |
const split = curr.split('=') |
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
function fallbackCopyTextToClipboard(text) { | |
const textArea = document.createElement("textarea"); | |
textArea.value = text; | |
// Avoid scrolling to bottom | |
textArea.style.top = "0"; | |
textArea.style.left = "0"; | |
textArea.style.position = "fixed"; |
OlderNewer