Skip to content

Instantly share code, notes, and snippets.

Avatar

Grégory PLANCHAT gplanchat

View GitHub Profile
@gplanchat
gplanchat / Makefile
Created Dec 19, 2018
Get the best performances from your Magento 2.x
View Makefile
.PHONY: webperf
webperf:
rm -rf *
View coroutine.php
<?php
class DataTransformer
{
public function transform(): \Generator
{
while ($request = yield) {
yield $request . ' - appended';
}
}
View video-autoplay.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title</title>
<link rel="stylesheet" href="bower_components/material-design-lite/material.css" type="text/css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
View gist:3ae97c44425512d108ef
### Keybase proof
I hereby claim:
* I am gplanchat on github.
* I am gplanchat (https://keybase.io/gplanchat) on keybase.
* I have a public key whose fingerprint is 8009 DB5C EC65 87FC E5F8 AFA6 C7AF 5AE0 49C8 2C1D
To claim this, I am signing this object:
@gplanchat
gplanchat / SortableTrait.php
Last active Jan 26, 2016 — forked from real34/SortableTrait.php
Allow to implement sorting in a Magento frontend Block easily.
View SortableTrait.php
<?php
trait Foo_Catalog_Block_List_SortableTrait
{
/**
* @var string
*/
protected $_orderVarName = 'order';
/**
View di.php
<?php
function factory($path, ...$args) {
$callback = require $path . '.php';
if (!$callback instanceof Closure) {
return $callback;
}
return $callback(...$args);
}
View Mage_Core_Model_Config.patch
diff --git a/web/app/code/core/Mage/Core/Model/Config.php b/web/app/code/core/Mage/Core/Model/Config.php
index bc68381..2e7c009 100644
--- a/web/app/code/core/Mage/Core/Model/Config.php
+++ b/web/app/code/core/Mage/Core/Model/Config.php
@@ -843,12 +843,7 @@ class Mage_Core_Model_Config extends Mage_Core_Model_Config_Base
foreach ($modules as $moduleName => $moduleProps) {
$depends = $moduleProps['depends'];
foreach ($moduleProps['depends'] as $depend => $true) {
- if (!$moduleProps['active']) {
- $depends = [];
View Setup.php
diff --git a/web/app/code/core/Mage/Eav/Model/Entity/Setup.php b/web/app/code/core/Mage/Eav/Model/Entity/Setup.php
index 6f3395e..0b56d75 100644
--- a/web/app/code/core/Mage/Eav/Model/Entity/Setup.php
+++ b/web/app/code/core/Mage/Eav/Model/Entity/Setup.php
@@ -1209,12 +1209,12 @@ class Mage_Eav_Model_Entity_Setup extends Mage_Core_Model_Resource_Setup
$isNoDefaultTypes = $this->_getValue($options, 'no-default-types', false);
$customTypes = $this->_getValue($options, 'types', array());
$tables = array();
+ $connection = $this->getConnection();
@gplanchat
gplanchat / Abstract.php
Created Jun 5, 2015
PHP 5.5 patch for Magento 1.9
View Abstract.php
<?php
class Mage_Core_Helper_Abstract
{
//...
/**
* Remove html tags, but leave "<" and ">" signs
*
* @param string $html
* @return string
*/
You can’t perform that action at this time.