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 [host, mask] = ev.target.value.split('/'); | |
if (host.split('.').length !== 4 || mask === undefined || !mask.length ||isNaN(mask)) { | |
console.warn('invalid input') | |
return; | |
} | |
const arrBinHost = host.split('.').map((octet) => { | |
const octetArr = Number(octet).toString(2).split(''); | |
const octetArrLength = octetArr.length |
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
// inputs | |
const A = [2,3,9,2,5,1,3,7,10] | |
const B = [2,1,3,4,3,10,6,6,1,7,10,10,10] | |
const P = 2; | |
// expected results for that inputs | |
// [2,9,2,5,7,10] | |
// test larger input arrays | |
// for (let i = 0; i < 100000; i += 1) { | |
// A.push(Math.floor(Math.random()*1000)) |
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
try { | |
const qResponse = await client.query( | |
[ | |
q.Select(['data', 'total'], | |
q.Let( | |
{ | |
lang: q.Get(q.Match(q.Index('languageByIndex'), main.languageIndex)), | |
ref: q.Select(['ref'], q.Var('lang')), | |
}, | |
q.Update(q.Var('ref'), |
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
computed: { | |
mistakesHistory() { | |
return this.history.filter((change) => change.type === 'mistake'); | |
}, | |
mistakes() { | |
return this.mistakesHistory.reduce((acc, mistake) => { | |
if (mistake.shift && mistake.expectedText !== ' ') { | |
if (mistake.text.toLowerCase() === mistake.expectedText | |
|| (mistake.text.match(/[~!@#$%^&*()_+{}:"|<>?]/) | |
&& mistake.expectedText.match(/[`1234567890-=[\];'\\,./]/) |