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
console.log('this is public Integromat test') |
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 randomNumber = Math.ceil(Math.random() * 100) | |
let guessedNumber | |
do { | |
guessedNumber = Number(window.prompt(`I'm thinking of number between 1 and 100. Your guess:`)) | |
if (randomNumber > guessedNumber) { | |
window.alert(`I'm thinking of HIGHER number than that.`) | |
} | |
if (randomNumber < guessedNumber) { |
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
import modernJquery from 'modernJquery' | |
import legacyJquery from 'legacyJquery' | |
console.log('Look how much Jquery we can pack into single bundle!') | |
// 3.x.x | |
console.log('This is Jquery version:', modernJquery().jquery) | |
// 2.x.x | |
console.log('This is Jquery version:', legacyJquery().jquery) |
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 = { | |
css: { | |
loaderOptions: { | |
sass: { | |
prependData: `@import "./styles/_variables.scss";` | |
} | |
} | |
} | |
}; |
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 BrowserEvent = (eventName = '') => { | |
let event | |
if (typeof Event === 'function') { | |
event = new Event(eventName) | |
} else { | |
event = document.createEvent('Event') | |
event.initEvent(eventName, true, true) | |
} |
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
// môže hodiť chybu, ak chýba `data`, `user` alebo `address` | |
const city = data.user.address.city | |
// relatívne bezpečné, ale strašne hnusné | |
const city = data && | |
data.user && | |
data.user.address && | |
data.user.address.city | |
// ešte bezpečnejšie, ale o to hnusnejšie |
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
/** | |
* @typedef {Object} SerializeOptions | |
* @param {String} [pairDelimiter = '='] Delimiter to be used between each key and value. | |
* @param {String} [itemDelimiter = '&'] Delimiter to be used between each pair. | |
*/ | |
/** | |
* Converts data object to a string, using delimiters. Primarily used to generate URL parameters. | |
* @param {Object} [data = {}] | |
* @param {SerializeOptions} [options] |
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
<template> | |
<div> | |
<p> | |
First name:<br> | |
<input v-model="first" @input="handleNameChange"> | |
</p> | |
<p> | |
Last name:<br> | |
<input v-model="last" @input="handleNameChange"> | |
</p> |
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
/** | |
* @typedef {Object} gatedQueueInterface | |
* @property {Function} openGate - Executes all functions currently in the queue. Functions added to the queue will be executed immediately, until the gate is closed again. | |
* @property {Function} closeGate - Closes the gate. Functions added to the queue will be executed only once the gate is opened again. | |
* @property {function(): boolean} isGateOpen - Checks whether the gate is currently open. | |
* @property {Function} addToQueue - Adds function(s) to the queue. Accepts single function or an array of functions. | |
* @property {Function} clearQueue - Removes all functions from the queue. | |
* @property {Function} processQueue - Calls all functions in the queue. Even if the gate is currently closed. | |
* @property {Function} getQueue - Returns copy of current queue. | |
*/ |
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 formatAsCurrency (value = 0, currency = '$') { | |
const formattedValue = (value/100).toFixed(2) | |
return currency + formattedValue | |
} | |
formatAsCurrency(100) | |
// $1.00 | |
formatAsCurrency(123) | |
// $1.23 |
NewerOlder