Skip to content

Instantly share code, notes, and snippets.

View mhauri's full-sized avatar

Marcel Hauri mhauri

View GitHub Profile
IvanChepurnyi /
Created September 30, 2016 16:00
Optimizes autoloader for the best performance on production system
cd $magentodir
read -d '' script << PHP
\$composer = json_decode(file_get_contents('composer.json'), true);
if (!is_array(\$composer['autoload']['psr-0'][''])) {
Vinai / M2 acl.xml
Last active October 17, 2023 05:38
My current Magento 2 PHPStorm File Templates (Feb 2016)
<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<resource id="Magento_Backend::admin">
blindpet / purgevarnishsingle
Last active May 20, 2023 09:51
clear one url home page varnish cache
Enter varnish admin
clear cache for index home page only
ban ~ && req.url ~ "^/$"
clear cache for specific page
raybogman / SupportDesk_FixAcl.php
Last active July 6, 2018 19:00
* SupportDesk_FixAcl.php v1.1
* SupportDesk (
* 10/7/2015
* This source file is subject to the Open Software License (OSL 3.0)
* It is available through the world-wide-web at this URL:
avoelkl / gist:49563c516d6cb318eb34
Last active June 5, 2024 12:41
Non-blocking and quick database dumps for large databases


Add --single-transaction and --quick to your mysqldump command.


sets the isolation mode to REPEATABLE READ and starts a transaction before dumping data. useful for InnoDB tables, dumps the consistent state without blocking any applications.


SchumacherFM /
Last active September 21, 2018 10:05
Avoiding database deadlocks in Magento 1.7

After having many deadlocks due to a high order volumne I've applied the these fixes to the core. Some can be found in a Magento forum. Before the fixes we could only process 1 order every 5-10 secs. Updating to Magento 1.8 is currently not an option but in 1-2 months.

1st Deadlock

Mage_Sales_Model_Abstract::_afterSave must be removed and replaced with afterCommitCallback. This is important to move the grid update (of sales_flat_order_grid) out of the transaction.

2nd Deadlock

Rewrite the method of the Mage_CatalogInventory_Model_Observer::reindexQuoteInventory() to remove the price reindexing from the transaction. That index process will also be fired in event sales_model_service_quote_submit_success.

dixson3 /
Created January 10, 2014 19:11
Create and manage a case-sensitive disk-image on OSX. This is great when you have a need to work with case-sensitive repos on a mac.
# where to store the sparse-image
create() {
hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 60g -volname workspace ${WORKSPACE}
detach() {
malarkey / Contract Killer
Last active May 24, 2024 23:38
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008