Skip to content

Instantly share code, notes, and snippets.

Peter Jaap Blaakmeer peterjaap

Block or report user

Report or block peterjaap

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
peterjaap / 1_product_queries.sql
Created Sep 16, 2019 — forked from itris/1_product_queries.sql
Magento 2 - Remove duplicate store view-specific product and category data
View 1_product_queries.sql
* IMPORTANT: The queries below are written for Magento Enterprise. If you're going to run them on Magento Community, you need
* to replace all instances of ".row_id" with ".entity_id". See this for context:
* When importing products in Magento 2, if you specify store view codes in the store_view_code column, product data will be set at
* both the global scope as well as the specific store view scope. This is not ideal because now you have duplicate
* data at two different scopes that shouldn't actually be duplicated. The scripts below clean up this data by finding
* data set at specific store view scopes and if it's an exact match to the data set at the global store view, then it
* deletes the data set at the specific store view scope.
peterjaap / lockComposerJsonToPatchReleases.php
Last active Jul 1, 2019
Lock your composer.json package versions to the latest installed version and prepend a tilde to lock to patch releases only
View lockComposerJsonToPatchReleases.php
// One-line all the things !1!1!!
// wget && php lockComposerJsonToPatchReleases.php && rm lockComposerJsonToPatchReleases.php
$composerLockData = json_decode(file_get_contents('composer.lock'), true);
$composerJsonData = json_decode(file_get_contents('composer.json'), true);
$excludedPackages = ['magento/product-community-edition', 'composer/composer'];
peterjaap / convertDeityTranslationJsonToOneSkyCSV.php
Created Jun 18, 2019
Convert Deity translation JSON file to OneSky CSV format. Usage; php convertTranslationJson.php client/node_modules/@deity/falcon-i18n/i18n/en/translations.json
View convertDeityTranslationJsonToOneSkyCSV.php
$input = json_decode(file_get_contents($argv[1]));
$output = [];
foreach ($input as $aKey => $aValue) {
if (is_object($aValue) || is_array($aValue)) {
foreach ($aValue as $bKey => $bValue) {
if (is_object($bValue) || is_array($bValue)) {
foreach($bValue as $cKey => $cValue) {
peterjaap /
Created Apr 1, 2019
Oneliner to quickly diff a re-ordered Magento 2 config.php file
git diff app/etc/config.php > temp; diff -wB <(sort temp) <(git show HEAD:temp | sort -); rm temp
peterjaap / PRODSECBUG-2198-2.2-CE-2019-03-25-08-43-16-module-catalog.patch
Last active Mar 27, 2019
Magento 2.2 patch for PRODSECBUG-2198 in composer.patches.json format for magento/module-catalog. See for magento/framework
View PRODSECBUG-2198-2.2-CE-2019-03-25-08-43-16-module-catalog.patch
diff --git a/Model/Product/ProductFrontendAction/Synchronizer.php b/Model/Product/ProductFrontendAction/Synchronizer.php
index 7a1926c..331c667 100644
--- a/Model/Product/ProductFrontendAction/Synchronizer.php
+++ b/Model/Product/ProductFrontendAction/Synchronizer.php
@@ -138,7 +138,9 @@ class Synchronizer
$productIds = [];
foreach ($actions as $action) {
- $productIds[] = $action['product_id'];
+ if (isset($action['product_id']) && is_int($action['product_id'])) {
peterjaap / PRODSECBUG-2198-2.2-CE-2019-03-25-08-43-16-framework.patch
Last active Mar 29, 2019
Magento 2.2 patch for PRODSECBUG-2198 in composer.patches.json format for magento/framework. See for magento/module-catalog
View PRODSECBUG-2198-2.2-CE-2019-03-25-08-43-16-framework.patch
diff --git a/DB/Adapter/Pdo/Mysql.php b/DB/Adapter/Pdo/Mysql.php
index 1449d6d..38085a3 100644
--- a/DB/Adapter/Pdo/Mysql.php
+++ b/DB/Adapter/Pdo/Mysql.php
@@ -2904,7 +2904,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
if (isset($condition['to'])) {
$query .= empty($query) ? '' : ' AND ';
$to = $this->_prepareSqlDateCondition($condition, 'to');
- $query = $this->_prepareQuotedSqlCondition($query . $conditionKeyMap['to'], $to, $fieldName);
+ $query = $query . $this->_prepareQuotedSqlCondition($conditionKeyMap['to'], $to, $fieldName);
peterjaap / .gitlab-ci.yaml
Last active Mar 5, 2019
Generic Gitlab CI file to build and push a Docker container to the private registry using kaniko (no Docker in Docker privileged mode needed)
View .gitlab-ci.yaml
image: docker:latest
- build
stage: build
- master
peterjaap / gatsby-node.js
Last active Nov 21, 2018
Magento 2.3 GraphQL all products query for Gatsby
View gatsby-node.js
const _ = require('lodash')
const { GraphQLClient } = require('graphql-request')
const path = require('path')
const crypto = require('crypto')
const baseUrl = ''
const { createRemoteFileNode } = require(`gatsby-source-filesystem`)
// Query Magento 2.3
peterjaap / magento-2-3-occurrence-analysis.csv
Last active Oct 4, 2018
Occurrence analysis on backward incompatible classes/interfaces of current state of Magento 2.3 upgrade on non-core code of one of our 2.2.6 shops. Based on
View magento-2-3-occurrence-analysis.csv
Class/Interface Occurrences
Magento\Catalog\Model\Product 1777
Magento\Store\Model\Store 1658
Magento\Sales\Model\Order 1267
Magento\Store\Model\StoreManagerInterface 1166
Magento\Quote\Model\Quote 803
Magento\Framework\Filesystem 702
Magento\Catalog\Model\ResourceModel\Product 559
Magento\Framework\App\ResourceConnection 534
Magento\Config\Model\Config 509
peterjaap / customer-sensitive-columns.sql
Created Jul 10, 2018
Quick query to find possible customer-data sensitive columns
View customer-sensitive-columns.sql
SELECT table_schema, table_Name, column_name FROM information_schema.columns
WHERE table_schema = 'yourdatabasename' AND
column_name LIKE '%address%'
OR column_name LIKE '%email%'
OR column_name LIKE '%customer_%'
AND column_name NOT LIKE 'customer_%id%'
AND column_name NOT LIKE 'email_%id%'
ORDER BY table_name,ordinal_position
You can’t perform that action at this time.