Skip to content

Instantly share code, notes, and snippets.

View erikhansen's full-sized avatar

Erik Hansen erikhansen

View GitHub Profile
[xdebug]
xdebug.profiler_enable_trigger=on
xdebug.remote_autostart=off
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.idekey=ECLIPSE_XDEBUG
xdebug.collect_vars=on
xdebug.collect_params=4
@erikhansen
erikhansen / web70_env.php
Last active December 28, 2017 22:38
dev-web70 Gist - The purpose of this Gist is to provide a template Magento 2 env.php file to use within the davidalger/devenv environment. See usage instructions below: https://gist.github.com/erikhansen/94db292fe3650d5991dc#gistcomment-1700442
<?php
return array (
'backend' =>
array (
'frontName' => 'backend',
),
'crypt' =>
array (
'key' => '<KEY>',
),
@erikhansen
erikhansen / magento1_enterprise_index_diagnostics.sql
Created February 18, 2016 14:46 — forked from mttjohnson/magento1_enterprise_index_diagnostics.sql
Magento 1.x Enterprise Partial Indexing Diagnostics Toolset
-- When products are added/removed from a category this table stores all the relation data
select * from catalog_category_product where product_id = '218';
-- The index that is used for presenting products in a category on the frontend
select * from catalog_category_product_index where product_id = '218';
-- The change log table used for Magento EE partial index functionality
select * from catalog_category_product_index_cl where product_id = '218';
-- The cron job that gets executed on each cron execution - check for errors
@erikhansen
erikhansen / _responsive.less
Last active August 18, 2017 03:55
Magento 2 Responsive Media Queries
// /**
// * Copyright © 2015 Magento. All rights reserved.
// * See COPYING.txt for license details.
// */
//
// Responsive
// _____________________________________________
//
@erikhansen
erikhansen / readme.md
Last active September 11, 2017 19:14 — forked from GianlucaGuarini/post-merge
Git hook that gets triggered after any 'git pull' whenever one of the files specified has changed. Useful to update any web application dependency.

How to create a global git commit hook by Matt Venables

1 Enable git templates (This tells git to copy everything in ~/.git-templates to your per-project .git/ directory when you run git init):

git config --global init.templatedir '~/.git-templates'

2 Create a directory to hold the global hooks:

mkdir -p ~/.git-templates/hooks

@erikhansen
erikhansen / web56_env.php
Last active November 15, 2016 16:20
dev-web56 Gist - The purpose of this Gist is to provide a template Magento 2 env.php file to use within the davidalger/devenv environment. See usage instructions below: https://gist.github.com/erikhansen/cfa278a80a6684bb7aa8d79ebcbf2f63#gistcomment-1922462
<?php
return array (
'backend' =>
array (
'frontName' => 'backend',
),
'crypt' =>
array (
'key' => '<KEY>',
),
@erikhansen
erikhansen / braintree_settlement.sh
Created November 29, 2016 23:29 — forked from mttjohnson/braintree_settlement.sh
Braintree manual transaction settlement
# Setup local directory with braintree example and libraries
git clone git@github.com:braintree/braintree_php_example.git
cd braintree_php_example
composer install
# Create and define configuration options
echo '
BT_ENVIRONMENT=sandbox
BT_MERCHANT_ID=xxxxxxxxxxxx
BT_PUBLIC_KEY=xxxxxxxxxxxx
@erikhansen
erikhansen / 1_product_queries.sql
Last active May 30, 2024 09:01
Magento 2 - Remove duplicate store view-specific product and category data
/*
* 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: http://magento.stackexchange.com/questions/139740/magento-2-schema-changes-for-ee-catalog-staging
*
* 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.
*
@erikhansen
erikhansen / generate_sanitize_queries.sql
Last active October 24, 2019 19:22
Sanitize customer emails from Magento database. UPDATE: Use this instead: https://github.com/elgentos/masquerade
/*
Run the following query to get a set of queries that will purge all tables of email addresses. The queries that are output from
this should be manually reviewed to remove queries for any unnecessary tables and can then be run manually or via a Magerun "db:query"
to include it as a part of a scripted cloning process.
IMPORTANT: Make sure to update the @db_name variable
What the resulting query will do:
-- Replace the emails in Magento with dummy emails (unless email is one of the whitelisted domains) in order to prevent emails erroneously being sent to customers.
-- Make all emails with @example.com and use and MD5 of the original domain of the email as the tag for the email. This is important in case we have two emails with the
-- same "local part" but different "domain part". For example, bob.smith@yahoo.com would become bob.smith+c9d12f@example.com
@erikhansen
erikhansen / show-detailed-error-when-duplicate-url-key.patch
Created June 9, 2017 17:53
Patch to see what is causing the "URL key for specified store already exists" error when saving entities in Magento 2. This patch should only be temporarily applied and needs to be applied to the vendor/magento/module-url-rewrite directory.
From 3523dd79d949f93e31fc675b190f17baf66f36c3 Mon Sep 17 00:00:00 2001
From: Erik Hansen <erikpallhansen@gmail.com>
Date: Wed, 1 Feb 2017 13:20:02 -0600
Subject: [PATCH] Edit the 'URL key for specified store already exists' message
---
Model/Storage/AbstractStorage.php | 5 ++++-
Model/Storage/DbStorage.php | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)