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
{{block class="Magento\\Cms\\Block\\Block" block_id="block-home-banners"}} |
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
// ES6 method | |
// Get all buttons as a NodeList | |
var btns = document.querySelectorAll('button'); | |
// Convert buttons NodeList to an array | |
var btnsArr = Array.from(btns); |
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
// slice method | |
var sandwiches = ['turkey', 'tuna', 'chicken salad', 'italian', 'blt', 'grilled cheese']; | |
// ['chicken salad', 'italian', 'blt', 'grilled cheese'] | |
var fewerSandwiches = sandwiches.slice(2); | |
// ['chicken salad', 'italian', 'blt'] | |
var fewerSandwiches2 = sandwiches.slice(2, 4); | |
// ['italian', 'blt', 'grilled cheese'] |
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
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/test.log'); | |
$logger = new \Zend\Log\Logger(); | |
$logger->addWriter($writer); | |
$logger->info(print_r($variable, 1)); | |
M2.4 | |
$writer = new \Zend_Log_Writer_Stream(BP . '/var/log/custom.log'); | |
$logger = new \Zend_Log(); | |
$logger->addWriter($writer); | |
$logger->info(print_r($variable, 1)); |
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
objArray.find(function (obj) { return obj.id === 3; }); |
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
<img | |
width="180" | |
height="52" | |
src="{{view url='images/email/youtube.jpg'}}" | |
alt="Elcometer Youtube" | |
/> |
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
if (window.matchMedia('(min-width: 640px)').matches) { | |
console.log('Wide viewport'); | |
} else { | |
console.log('Small viewport'); | |
} | |
if (window.matchMedia('(orientation: portrait)').matches) { | |
console.log('Portrait'); | |
} else { | |
console.log('Landscape'); |
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
var add = function () { | |
var total = 0; | |
for (var i = 0; i < arguments.length; i++) { | |
total += arguments[i]; | |
} | |
return total; |
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
// https://gomakethings.com/why-the-vanilla-js-matches-method-wont-work-with-event-listeners-and-nested-links/ | |
// closest to get element or parents | |
document.addEventListener('click', function (event) { | |
// If the clicked element doesn't have the class, bail | |
if (!event.target.closest('.click-me')) return; | |
// Otherwise, do whatever... |
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
// https://gomakethings.com/breakpoint-conditional-javascript-in-vanilla-js/ | |
// Define our viewportWidth variable | |
var viewportWidth; | |
// Set/update the viewportWidth value | |
var setViewportWidth = function () { | |
viewportWidth = window.innerWidth || document.documentElement.clientWidth; | |
} |