Skip to content

Instantly share code, notes, and snippets.

View jissereitsma's full-sized avatar

Jisse Reitsma jissereitsma

View GitHub Profile
<?php
require_once 'app/Mage.php';
Mage::app();
$collection = Mage::getModel('facebooksignup/facebooksignup')
->getCollection()
->addFieldToFilter('customer_id',$user_id)
->limit(1); //////line 19 is here
foreach ($collection as $data) {
<?php
/*
* - Switch to composer package
* - Namespacing
* - Use file/handler package
* - Use downloader package
* - Use image creation package
*/
interface ImageGenerator
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `cataloginventory_stock_item`;
TRUNCATE TABLE `cataloginventory_stock_status`;
TRUNCATE TABLE `cataloginventory_stock_status_idx`;
TRUNCATE TABLE `cataloginventory_stock_status_tmp`;
TRUNCATE TABLE `catalog_category_product`;
TRUNCATE TABLE `catalog_category_product_index`;
TRUNCATE TABLE `catalog_category_product_index_tmp`;
@jissereitsma
jissereitsma / dutchento-meetup-data.php
Created July 15, 2017 10:51
Dutchento meetup data of all Magento User Groups
<?php
include_once 'vendor/autoload.php';
use DMS\Service\Meetup\MeetupKeyAuthClient;
$apiKey = 'enter-your-own-meetup-api-key';
$client = MeetupKeyAuthClient::factory(array('key' => $apiKey));
$meetupGroupUrlNames = array(
'Magento-User-Group-Friesland',
@jissereitsma
jissereitsma / magento_clean_attribute_source_models.php
Created October 7, 2017 08:33
Magento 1 script to reset attribute models if model can not be instantiated (because module is uninstalled)
<?php
require_once 'app/Mage.php';
Mage::app();
$autoFix = true;
class Clean_Attribute_Source_Models
{
private $autofix;
private $modelFields = ['backend_model', 'frontend_model', 'source_model'];
@jissereitsma
jissereitsma / less_import_parser.php
Created August 7, 2018 06:58
Script to read a LESS file, resolve its @imports and generate a new LESS file
<?php
declare(strict_types=1);
class LessImportParser
{
private $content = '';
public function load(string $fileName)
{
$this->content = $this->resolveImports($fileName);
@jissereitsma
jissereitsma / nginx-sample-snippet.conf
Last active September 25, 2020 13:26
Partial Nginx configuration for Magento 2 with React app in `/public/pwa` folder
#location = / {
# try_files $uri /index.php;
#}
#location / {
# try_files $uri $uri/ /index.php?$args;
#}
location = / {
try_files /pwa/index.html =404;
@jissereitsma
jissereitsma / parse_query_arguments.php
Created April 17, 2020 16:04
Simple PHP script to destructure query arguments from an URL
<?php
if (!isset($argv) || count($argv) !== 2) {
die('Usage: ' . basename(__FILE__ ). ' {URL}'."\n");
}
$url = $argv[1];
if (empty($url)) {
die("Empty URL");
}
@jissereitsma
jissereitsma / remove-laminas-from-setup-landing-controller.patch
Created August 3, 2020 09:11
Fix Laminas MVC addition in Magento 2.3.4 file setup/src/Magento/Setup/Controller/Landing.php
--- setup/src/Magento/Setup/Controller/Landing.php 2020-08-03 10:54:26.952234698 +0200
+++ setup/src/Magento/Setup/Controller/Landing.php 2020-08-03 10:54:35.300358599 +0200
@@ -5,8 +5,8 @@
*/
namespace Magento\Setup\Controller;
-use Laminas\Mvc\Controller\AbstractActionController;
-use Laminas\View\Model\ViewModel;
+use Zend\View\Model\ViewModel;
+use Zend\Mvc\Controller\AbstractActionController;
@jissereitsma
jissereitsma / fix-memory-report-after-integration-tests.patch
Last active August 3, 2020 10:31
Fix memory report in certain CI environments, after integration tests have run successfully
--- dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php 2020-08-03 11:38:00.536570075 +0200
+++ dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php 2020-08-03 11:40:49.483161722 +0200
@@ -55,6 +55,7 @@
} catch (\Magento\Framework\Exception\LocalizedException $e) {
// try to use the Windows command line
// some ports of Unix commands on Windows, such as MinGW, have limited capabilities and cannot be used
+ die($e->getMessage());
$result = $this->_getWinProcessMemoryUsage($pid);
}
return $result;