Skip to content

Instantly share code, notes, and snippets.

View sylvainraye's full-sized avatar

Sylvain Rayé sylvainraye

View GitHub Profile
@nicanaca0
nicanaca0 / ImportProductsCommand.php
Last active May 1, 2024 11:05
Simple CSV Product importer for Sylius. Includes the product, the variant, channel pricing, taxons images and associations (1.0.0-beta.2)
<?php
namespace AppBundle\Command;
use Sylius\Component\Core\Model\ChannelPricingInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Model\ProductVariantInterface;
use Sylius\Component\Product\Model\ProductAssociationInterface;
use Sylius\Component\Product\Model\ProductAssociationTypeInterface;
use Sylius\Component\Taxonomy\Model\TaxonInterface;
@piotrekkaminski
piotrekkaminski / MPERF-10565.diff
Created April 8, 2019 18:04
MPERF-10565.diff - logging to a file that does not exist issue
diff --git a/app/Mage.php b/app/Mage.php
index 0e650eebb4f..9c18e222689 100644
--- a/app/Mage.php
+++ b/app/Mage.php
@@ -798,9 +798,9 @@ public static function log($message, $level = null, $file = '', $forceLog = fals
',',
(string) self::getConfig()->getNode('dev/log/allowedFileExtensions', Mage_Core_Model_Store::DEFAULT_CODE)
);
- $logValidator = new Zend_Validate_File_Extension($_allowedFileExtensions);
$logDir = self::getBaseDir('var') . DS . 'log';

Run on changed files:

php bin/phpcs {} -p --encoding=utf-8 --extensions=php --standard=vendor/oro/platform/build/Oro/phpcs.xml

php bin/php-cs-fixer fix {} --verbose --dry-run --config=vendor/oro/platform/build/.php-cs-fixer.php

php bin/phpmd {} text vendor/oro/platform/build/phpmd.xml --suffixes php 

where {} is the changed file

@mehdichaouch
mehdichaouch / magento2_debug_ui_component.js
Created December 17, 2020 10:16
Magento 2 - Debug UI Component (showing spinner) #magento2 #uicomponent
// https://magento.stackexchange.com/questions/310578/how-to-debug-ui-component-only-showing-spinner
// https://devdocs.magento.com/guides/v2.4/javascript-dev-guide/javascript/js_logger.html
require(['Magento_Ui/js/lib/logger/console-logger',
'Magento_Ui/js/lib/logger/levels-pool'],
function(logger, levels) {
logger.setDisplayLevel(5) // 2 = WARN 5 = ALL, see levels-pool.js
}
);
@gplanchat
gplanchat / php_unserialize_to_json.sql
Last active July 28, 2022 10:01 — forked from damoclark/php_unserialize_to_json.sql
PHP unserialize in Postgresql to json
/**
Decode a php serialized value to json. This function only supports basic
data types:
- arrays (will always become a json object)
- booleans
- integers
- floats
- strings
- NULL
@FredericMartinez
FredericMartinez / tinymce4Adapter.js
Last active March 17, 2021 15:10
Remove <p> WYSIWYG Magento 2
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*
* => app/design/adminhtml/Namespace/project_name/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js
*/
/* global popups, tinyMceEditors, MediabrowserUtility, Base64 */
/* eslint-disable strict */
define([
@dnahrebecki
dnahrebecki / EstimateClocCommand.php
Created February 16, 2022 13:39
Command for generating LOC statistics for a Symfony project
<?php
namespace App\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;