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
UPDATE admin_user SET password = CONCAT(SHA2('xxxxxxxYourNewPassword', 256), ':xxxxxxx:1') WHERE username = 'admin'; | |
-- REST Customer & Admin password | |
SET @pass = '123123q'; -- pone el pass q mas te guste | |
SET @salt = MD5(UNIX_TIMESTAMP()); | |
UPDATE admin_user SET password = CONCAT(SHA2(CONCAT(@salt, @pass), 256), ':', @salt, ':1'); | |
UPDATE customer_entity SET password_hash= CONCAT(SHA2(CONCAT(@salt, @pass), 256), ':', @salt, ':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
<template name="magento2:__" value="<?php echo __('$SELECTION$'); ?>" description="Translation" toReformat="false" toShortenFQNames="true"> | |
<context> | |
<option name="HTML" value="true" /> | |
<option name="PHP" value="true" /> | |
</context> | |
</template> | |
<template name="magento2:collection" value="class Collection extends AbstractCollection { /** * Initialize resource model * * @return void */ protected function _construct() { $this->_init($model$::class, $resourceModel$::class); } }" toReformat="true" toShortenFQNames="true"> | |
<variable name="model" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="resourceModel" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> |
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
array_map('trim', explode(',', $str)); |
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
<?php | |
namespace Chapagain\HelloWorld\Block; | |
class HelloWorld extends \Magento\Framework\View\Element\Template | |
{ | |
public function __construct( | |
\Magento\Backend\Block\Template\Context $context, | |
array $data = [] | |
) | |
{ | |
parent::__construct($context, $data); |
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
// get current store and product store to restore values after save | |
$currentStore = $this->storeManager->getStore(); | |
$productStore = $product->getStoreId(); | |
// save to desired storeId | |
$this->storeManager->setCurrentStore($storeId); | |
$product->setStoreId($storeId); | |
// you can use also $product->setName ... | |
$product->setData($attributeCode, $value); | |
$this->productResource->saveAttribute($product, $attributeCode); |
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
// Common | |
// (for styles used in both mobile and desktop views) | |
& when (@media-common = true) {} | |
// Mobile | |
// (for all mobile styles.) | |
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {} | |
// Tablet | |
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {} |
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; | |
} |
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
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
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'); |