This file contains hidden or 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
:: Pick one of these two files (cmd or ps1) | |
:: Set directory for installation - Chocolatey does not lock | |
:: down the directory if not the default | |
SET INSTALLDIR=c:\ProgramData\chocoportable | |
setx ChocolateyInstall %INSTALLDIR% | |
:: All install options - offline, proxy, etc at | |
:: https://chocolatey.org/install | |
@powershell -NoProfile -ExecutionPolicy Bypass -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET PATH="%PATH%;%INSTALLDIR%\bin" |
This file contains hidden or 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
getUnique(arr, comp) { | |
const unique = arr | |
.map(e => e[comp]) | |
// store the keys of the unique objects | |
.map((e, i, final) => final.indexOf(e) === i && i) | |
// eliminate the dead keys & store unique objects | |
.filter(e => arr[e]).map(e => arr[e]); | |
return unique; | |
}, |
This file contains hidden or 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 debounce = (func) => { | |
let timeout; | |
const debounced = (...args) => { | |
const later = () => { | |
timeout = null; | |
func(...args); | |
}; | |
clearTimeout(timeout); | |
timeout = setTimeout(later, 1000); | |
if (!timeout) { |
This file contains hidden or 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
allAreSame() { | |
if (this.array.length) return; | |
const paramToCompare = this.array[0].key; | |
const comparation = this.array | |
.every(({ correspondingKey }) => correspondingKey === paramToCompare); | |
return comparation; | |
}, |
This file contains hidden or 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
notAgain(obj) { | |
const removeHandler = this.array.filter(item => item === obj) | |
if (removeHandler.length) { | |
this.array = this.array.filter(item => item !== obj) | |
return | |
} | |
this.array.push(obj) | |
} |
This file contains hidden or 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
removeEmpty(object) { | |
const obj = {}; | |
// eslint-disable-next-line no-restricted-syntax | |
for (const key in object) { | |
if ( | |
object[key] !== null && | |
object[key] !== false && | |
object[key] !== undefined | |
) { | |
obj[key] = object[key]; |
This file contains hidden or 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 timefix = 11000; | |
compiler.plugin('watch-run', (watching, callback) => { | |
watching.startTime += timefix; | |
callback() | |
}); | |
compiler.plugin('done', (stats) => { | |
stats.startTime -= timefix | |
}) |
This file contains hidden or 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
Cypress.Commands.add('upload_file', (fileName, selector) => { | |
return cy.get(selector).then(subject => { | |
return cy.fixture(fileName, 'base64') | |
.then(Cypress.Blob.base64StringToBlob) | |
.then(blob => { | |
const el = subject[0] | |
const testFile = new File([blob], fileName, { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }) | |
const dataTransfer = new DataTransfer() | |
dataTransfer.items.add(testFile) | |
el.files = dataTransfer.files |