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
// read value | |
JSON.stringify( | |
[...document.getElementsByClassName('js-row')].map(el => { | |
const key = el.querySelector('.js-ci-variable-input-key').value | |
const { value } = el.querySelector('textarea.js-ci-variable-input-value') | |
return [key, value] | |
}) | |
) | |
const result=[[]] //whatever from last step |
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 val = Array.from(document.getElementsByTagName('tbody')[1].children) | |
.filter(ele => ele.className === 'ng-scope') | |
.map(element => ({ | |
[element.children[0].children[0].value]: | |
element.children[1].children[0].value, | |
})) | |
.filter(value => Object.keys(value)[0]) | |
.reduce((curr, acc) => ({ ...curr, ...acc }), {}) | |
JSON.stringify(val) |
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 getSolution = require('./dic-lookup'); | |
const digit = 4; | |
const count = 1000; | |
const sut = getSolution(digit, count)(); | |
// should have 1000 elements | |
if (sut.size !== count) { | |
console.log(sut.size); | |
console.error('something goes wrong...'); |
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 maxLength(digit) { | |
return Math.pow(8, digit) * 9; | |
} | |
const getDic = digit => | |
Array.from(new Array(Math.pow(10, digit) - 1)) | |
.map((_, idx) => idx + 1) | |
.filter(v => v >= Math.pow(10, digit - 1)); | |
function random(max) { | |
return Math.floor(Math.random() * (max + 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 { | |
generator, | |
getSolution | |
} = require('./refined'); | |
const digit = 7; | |
const count = 10000; | |
const sut = getSolution(count)( | |
generator(digit) | |
)(); |
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 getNumber(digit = 4) { | |
return () => | |
Math.floor( | |
Math.random() * Math.pow(10, digit) | |
); | |
} | |
function getNumInRange(digit = 4) { | |
return function(numberGenerator) { | |
return function recursiveQuery() { |
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
//1357 just a random number to get thing started | |
const sut = require('./index')(1357); | |
// should have 1000 elements | |
if (sut.size !== 1000) { | |
console.log(sut.size); | |
console.error('something goes wrong...'); | |
} |
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 getNumber() { | |
return Math.floor(Math.random() * 10000); | |
} | |
function getFourDigitNum(pin) { | |
if (pin <= 1000) { | |
getFourDigitNum(getNumber()); | |
} | |
return pin; |
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 resolve(howMany) { | |
const arr = new Set(); | |
// generate stuff | |
function getNumber() { | |
return Math.floor(Math.random() * 10000); | |
} | |
function getFourDigitNum() { | |
let pin; |
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
module.exports = { | |
parser: 'babel-eslint', | |
env: { | |
commonjs: true, | |
es6: true, | |
node: true, | |
jest: true | |
}, | |
extends: ['eslint:recommended'], | |
parserOptions: { |
NewerOlder