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
/*migrate bootstrap columns to display:grid*/ | |
@supports (display: grid) { | |
.row { | |
display: grid; | |
grid-template-columns: repeat(12, minmax(10px, 1fr)); | |
grid-gap: 0; | |
margin: 0; | |
} | |
.col-md-1, .col-xs-1, .col-lg-1 { |
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
Validation.addAllThese([ | |
['validate-filesize','The file size should not exceed 100 kb.',function(v, elm){ | |
var maxSize = 102400; | |
if (navigator.appName == "Microsoft Internet Explorer") { | |
if (elm.value) { | |
var oas = new ActiveXObject("Scripting.FileSystemObject"); | |
var e = oas.getFile(elm.value); | |
var size = e.size; | |
} | |
} else { |
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
<?php | |
//In controller: | |
//No need to declare $this->resultRedirectFactory in construct as its auto declared in construct of \Magento\Framework\App\Action\Action to which custom controller should extend. | |
public function execute() | |
{ | |
$resultRedirect = $this->resultRedirectFactory->create(); | |
$resultRedirect->setPath('routename/controllerpath/controllername'); | |
$resultRedirect->setPath('');//home | |
return $resultRedirect; |
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
<?php | |
if (!function_exists('array_chunk_by')) { | |
/** | |
* Splits an array into chunks using a callback function. | |
* | |
* Chunks an array into arrays by iteratively applying the $callback function | |
* to the elements of the $array. | |
* | |
* @see https://rlaanemets.com/post/show/group-array-by-adjacent-elements-in-javascript |
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
// Instagram started setting cross-origin-resource-policy: same-origin when it sees bad referer headers. | |
// this change leads to ERR_BLOCKED_BY_RESPONSE error and broken images if instagram image is embedded to external website. | |
// to mitigate this, simple image proxy can be used. | |
// Steps to install this worker: | |
// 1. Create CNAME cdn.<yourdomain.com> in your CloudFlare panel | |
// 2. Create new worker and put the code below into the worker code | |
// 3. Setup worker route so the worker launches on your cdn. subdomain. | |
// 4. Modify your image urls from | |
// https://scontent-arn2-1.cdninstagram.com/v/t51.2885-15/sh0xxx.jpg | |
// to: |