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
# Enter varnish admin | |
varnishadm | |
# clear cache for index home page only | |
ban req.http.host ~ windparadise.com && req.url ~ "^/$" | |
# clear cache for specific page |
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
/* | |
By Ryan Mulligan | |
Source: https://css-tricks.com/bold-on-hover-without-the-layout-shift/ | |
*/ | |
.menu-link { | |
display: inline-flex; | |
flex-direction: column; | |
align-items: center; | |
justify-content: space-between; | |
padding: 1rem 1.5rem; |
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
SET [GLOBAL|SESSION] sql_mode='NO_AUTO_VALUE_ON_ZERO' |
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
-- Category: | |
SET @entity_id = 1; | |
(SELECT e.attribute_code, 'varchar' AS type, v.store_id, v.value FROM catalog_category_entity_varchar v | |
JOIN eav_attribute e ON e.attribute_id = v.attribute_id WHERE v.entity_id = @entity_id) | |
UNION | |
(SELECT e.attribute_code, 'datetime' AS type, v.store_id, v.value FROM catalog_category_entity_datetime v | |
JOIN eav_attribute e ON e.attribute_id = v.attribute_id WHERE v.entity_id = @entity_id) | |
UNION | |
(SELECT e.attribute_code, 'decimal' AS type, v.store_id, v.value FROM catalog_category_entity_decimal v |
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
SELECT | |
col, | |
COUNT(col) | |
FROM | |
table_name | |
GROUP BY col | |
HAVING COUNT(col) > 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
# File: vendor/magento/framework/App/State.php | |
public function emulateAreaCode($areaCode, $callback, $params = []) | |
{ | |
$currentArea = $this->_areaCode; | |
$this->_areaCode = $areaCode; | |
$this->_isAreaCodeEmulated = true; | |
try { | |
$result = call_user_func_array($callback, $params); | |
} catch (Exception $e) { | |
$this->_areaCode = $currentArea; |
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
<?xml version="1.0"?> | |
<!-- | |
Credits: https://mdotacademy.snippets.cc/collection/magento-2/create-route | |
Place this file in either the "frontend" or "adminhtml" folder to define either | |
a frontend or admin route, respectively: | |
ex. app/code/Foo/Bar/etc/frontend/routes.xml | |
The "urn:magento:framework:App/etc/routes.xsd" file is used to validate this | |
XML file. You can inspect it at vendor/magento/framework/App/etc/routes.xsd |
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 | |
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored) | |
// http://youtu.be/dQw4w9WgXcQ | |
// http://www.youtube.com/embed/dQw4w9WgXcQ | |
// http://www.youtube.com/watch?v=dQw4w9WgXcQ | |
// http://www.youtube.com/?v=dQw4w9WgXcQ | |
// http://www.youtube.com/v/dQw4w9WgXcQ | |
// http://www.youtube.com/e/dQw4w9WgXcQ | |
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ |
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
$api_key = "API Key" | |
$video_id = "Video ID" | |
$url = "https://www.googleapis.com/youtube/v3/videos?id=" . $video_id . "&key=" . $api_key . "&part=snippet,contentDetails,statistics,status"; | |
$json = file_get_contents($url); | |
$getData = json_decode( $json , true); | |
foreach((array)$getData['items'] as $key => $gDat){ | |
$title = $gDat['snippet']['title']; | |
} | |
// Output title | |
echo $title; |
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 | |
/* Source: https://mage2.pro/t/topic/1741/11 */ | |
namespace Yourcompany\Yourmodule\Controller\Test; | |
use Magento\Framework\Api\Data\VideoContentInterface; | |
use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface; | |
use Magento\Framework\App\Action\Context; | |
use Magento\ProductVideo\Model\Product\Attribute\Media\ExternalVideoEntryConverter; | |
use Magento\Store\Model\Store; | |
use Magento\Framework\Exception\InputException; |