Skip to content

Instantly share code, notes, and snippets.

View Marko-M's full-sized avatar

Marko Martinović Marko-M

View GitHub Profile
@Marko-M
Marko-M / magento-nginx.conf
Created December 1, 2016 15:10 — forked from gwillem/magento-nginx.conf
Battle-tested Nginx configuration for Magento (source: www.hypernode.com)
# This is an annotated subset of the Nginx configuration from our Magento production platform @ www.hypernode.com
# See https://www.byte.nl/blog/magento-cacheleak-issue
# !!!! If you are a Hypernode customer, do not use this config as it will result in duplicate statements. !!!!!
user app;
worker_processes 4;
pid /var/run/nginx.pid;
events {
@Marko-M
Marko-M / gist:c91895a815b3d89896196367206b1d74
Last active September 10, 2016 11:16
Vagrant sudo NOPASSWD (Ubuntu 16.04)
sudo -i
cat > /etc/sudoers.d/10_vagrant <<EOF
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
Cmnd_Alias VAGRANT_NFSD_CHECK = /etc/init.d/nfs-kernel-server status
Cmnd_Alias VAGRANT_NFSD_START = /etc/init.d/nfs-kernel-server start
Cmnd_Alias VAGRANT_NFSD_APPLY = /usr/sbin/exportfs -ar
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /bin/sed -r -e * d -ibak /*/exports
Cmnd_Alias VAGRANT_EXPORTS_REMOVE_2 = /bin/cp /*/exports /etc/exports
%sudo ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD_CHECK, VAGRANT_NFSD_START, VAGRANT_NFSD_APPLY, VAGRANT_EXPORTS_REMOVE, VAGRANT_EXPORTS_REMOVE_2
@Marko-M
Marko-M / gist:f9517c7acfcdff75e976d82fb750dbe3
Last active June 11, 2016 11:24
Vagrant 1.8.3 with Ubuntu 16.04 LTS
#!/bin/bash
# Marko Martinović
# https://devgenii.com/
#
# Workaround for issue where Vagrant fails to install plugins due to RubyGems > v2.3.0 and Bundler Gem v1.12.0:
#
# ... `block in sort_dependencies': undefined method `payload' for nil:NilClass (NoMethodError)
#
# For example Vagrant 1.8.3 installed from .deb package @ HashiCorp website on Ubuntu 16.04 LTS.
@Marko-M
Marko-M / fpc-block-html-optimize.patch
Last active March 25, 2016 13:44
Magento improvement targeting FPC/block_html compatibility causing one cache storage access per layout block issue
--- app/code/core/Mage/Core/Block/Abstract.php 2016-03-25 14:22:51.934883000 +0100
+++ app/code/local/Mage/Core/Block/Abstract.php 2016-03-25 14:39:53.806883000 +0100
@@ -1,4 +1,17 @@
<?php
+/*
+ * Prevent unnecessary requests to cache storage on
+ *
+ * core_block_abstract_to_html_after
+ *
+ * due to
@Marko-M
Marko-M / magento-template-check.sh
Last active February 19, 2016 08:32
Magento Template Check
#!/bin/bash
grep -Ein "get(Singleton|(Resource)?Model)" $(find -name "*.phtml")
@Marko-M
Marko-M / product_attribute_installer.php
Created January 21, 2016 09:03 — forked from antoinekociuba/product_attribute_installer.php
Magento Product Attribute installer script.
<?php
/**
* Product Attribute Installer
*/
try {
/* @var $installer Mage_Catalog_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();
@Marko-M
Marko-M / gist:e8a7367b8c8699af0346
Last active December 10, 2015 14:16
Redis/Magento 1.x - Current Full Page Cache size in bytes
redis-cli -p 6379
127.0.0.1:6380> SELECT 0
OK
127.0.0.1:6380> KEYS *CAHCE*
1) "zc:k:446_FPC_CACHE_SIZE_CAHCE_KEY"
127.0.0.1:6380> HGET zc:k:446_FPC_CACHE_SIZE_CAHCE_KEY d
"3439338"
@Marko-M
Marko-M / soap-debug.php
Created November 23, 2015 08:07
Debug SOAP requests
<?php
/**
* Debug SOAP requests
*/
$client = new SoapClient(
'http://example.loc/index.php/api/v2_soap/?wsdl'
);
// Set yourself debug session cookie, for Xdebug and Phpstorm
@Marko-M
Marko-M / resave.php
Last active October 25, 2019 12:29
Script to re-save Magento store products per store/product type
<?php
require_once 'abstract.php';
class Mmartinovic_Shell_Resave extends Mage_Shell_Abstract
{
protected $_stores = [];
protected $_types = [];
public function __construct() {
parent::__construct();
@Marko-M
Marko-M / system.log
Created October 30, 2015 11:10
SUPEE-6788 system.log
2015-10-30T10:54:10+00:00 DEBUG (7): SELECT `main_table`.* FROM `permission_variable` AS `main_table` WHERE (`variable_name` = 'web/unsecure/base_url') AND (`is_allowed` = 1)
2015-10-30T10:54:11+00:00 DEBUG (7): SELECT `main_table`.* FROM `permission_variable` AS `main_table` WHERE (`variable_name` = 'web/unsecure/base_url') AND (`is_allowed` = 1)
2015-10-30T10:54:11+00:00 DEBUG (7): SELECT `main_table`.* FROM `permission_variable` AS `main_table` WHERE (`variable_name` = 'web/unsecure/base_url') AND (`is_allowed` = 1)
2015-10-30T10:54:11+00:00 DEBUG (7): SELECT `main_table`.* FROM `permission_variable` AS `main_table` WHERE (`variable_name` = 'web/unsecure/base_url') AND (`is_allowed` = 1)
2015-10-30T10:54:11+00:00 DEBUG (7): SELECT `main_table`.* FROM `permission_variable` AS `main_table` WHERE (`variable_name` = 'web/unsecure/base_url') AND (`is_allowed` = 1)
2015-10-30T10:54:11+00:00 DEBUG (7): SELECT `main_table`.* FROM `permission_variable` AS `main_table` WHERE (`variable_name` = 'web/unsecure/base_url