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
Func waitForExist($element, $iTimeOut) | |
$sBegin = TimerInit() | |
While TimerDiff($sBegin) < $iTimeOut | |
$isExist = WinExists($element) | |
If $isExist then | |
ConsoleWrite($isExist&@CRLF) | |
Return True | |
Else | |
ConsoleWrite($isExist&@CRLF) | |
ContinueLoop |
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
/** | |
ESTA FUNCION CREA VARIABLES DINAMICAMENTE BASADO EN UN OBJETO. | |
**/ | |
let etc = { name: 'foobar', city: 'xyz', company: 'companyName' }; | |
Object.keys(etc).forEach(key=>{return eval(`${key.toUpperCase()}='${etc[`${key}`]}'`)}); | |
console.log(NAME) //foobar | |
console.log(CITY) //xyz |
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 mutiplyAll=arr=>{let r=[];arr.forEach(x=>{x.forEach(y=>{return r.push(y)})});return r.reduce((acc, n) => n * acc)}; | |
console.log(mutiplyAll([[1,2], [3,4], [5,6,7]])); //5040 |
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 mutiplyAll=arr=>{let r=[];arr.forEach(x=>{x.forEach(y=>{return r.push(y)})});return r.reduce((acc, n) => n * acc)}; | |
console.log(mutiplyAll([[1,2], [3,4], [5,6,7]])); //5040 |
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 arr1 = [{ a: "a", 1: 1, 2: 2 }, { a: "b", 1: 1, 2: 3 }]; | |
const arr2 = [{ a: "a", 3: 123 }, { a: "b", 3: 4411 }]; | |
const result = [...arr1.concat(arr2) // concat the arrays | |
.reduce((m, o) => m.set(o.a, Object.assign(m.get(o.a) || {}, o)), // use a map to collect similar objects | |
new Map() | |
).values()]; // get the values iterator of the map, and spread into a new array | |
console.log(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
clearStr(str) { | |
const corrections = { | |
'&': '', | |
'\/': '', | |
'\\': '', | |
'#': '', | |
',': '', | |
'+': '', | |
'(': '', | |
')': '', |
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
let text = 'c'; | |
let findText = [text]; | |
let inArray = ["a",'c','d','g'] | |
let result = []; | |
findText.find(text => inArray.forEach(arrValue=>text == arrValue && result.push(text))); | |
console.log(JSON.stringify(result)); | |
// expected output: 12 |
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 FormatDateTime=str=>{ | |
let date = new Date(new Number(str)); | |
return (date instanceof Date && !isNaN(date)) ? { | |
year:date.getFullYear(), | |
month:(date.getMonth() + 1), | |
day:date.getDate(), | |
hour:date.getHours(), | |
minute:date.getMinutes(), | |
second:date.getSeconds(), | |
mlSecond:date.getMilliseconds() |
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 daysInMonth() { | |
return Array.from({length: new Date(new Date().getFullYear(), new Date().getMonth(), 0).getDate()}, (x,i)=> { return (i+1); }); | |
} | |
console.log(daysInMonth()); // 28 |
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
//VERSION 1 | |
const rand=()=>Math.random(0).toString(36).substr(2); | |
const token=(length)=>(rand()+rand()+rand()+rand()).substr(0,length); | |
console.log(token(10)); | |
//VERSION 2 | |
function generateToken(length){ | |
let rand=()=>Math.random(0).toString(36).substr(2); | |
return (rand()+rand()+rand()+rand()).substr(0,length) |