Skip to content

Instantly share code, notes, and snippets.

View mzeis's full-sized avatar
🤓

Matthias Zeis mzeis

🤓
View GitHub Profile
@marcoarment
marcoarment / S3.php
Last active June 18, 2024 14:15
A simple PHP class to perform basic operations against Amazon S3 and compatible services.
<?php
/*
A simple PHP class to perform basic operations against Amazon S3 and compatible
services. Requires modern PHP (7+, probably) with curl, dom, and iconv modules.
Copyright 2022 Marco Arment. Released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@brunoric
brunoric / phpcs_check_errors.sh
Last active March 17, 2018 17:41
PHPCS check on diff and pre-commit hook
#!/usr/bin/env bash
RED='\033[0;31m' # red color
YELLOW='\033[1;33m' # red color
NC='\033[0m' # no color
FILE=$1;
RELATIVE_FILE_PATH=$(realpath --relative-to=${PWD} ${FILE});
STANDARD_LIST='SmartboxMagento';
PHPCS_REPORT_JSON=;
PHPCS_DEFAULT='phpcs'
PHPCS_LOCATION=$2;
@renshuki
renshuki / ubuntu_agnoster_install.md
Last active May 25, 2024 06:37
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@Nyholm
Nyholm / gist:4c2a960531d5d81c062b
Last active November 30, 2017 19:58
Display flash messages in Symfony2
{# Check if we got a session without creating one #}
{% if app.request.hasPreviousSession %}
{# Check if we got some flash messages #}
{% if app.session.flashbag.peekAll()|length > 0 %}
<div id="flash">
{# Loop all types of flash messages #}
{% for type, flashMessages in app.session.flashbag.all() %}
{# For all flash messages with this type #}
{% for idx, flashMessage in flashMessages %}
<div class="flash-item flash-type-{{ type }}">
@alistairstead
alistairstead / local.xml
Created November 1, 2014 12:09
Disable the automatic application of update scripts on each page request following cache clear. Use MageRun to apply the upgrades manually within a controlled step.
<?xml version="1.0"?>
<config>
<global>
<skip_process_modules_updates>1</skip_process_modules_updates>
</global>
</config>
@renttek
renttek / 0001-BUGIFX-Magento-Zend-Framework-1-PHP5.6.patch
Last active July 5, 2021 17:42
Bugfix for Zend Framework 1 in Magento (>= 1.7.*.*) + PHP 5.6
From 473846959772d8160b34b92ae3bcecddf24b972f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julian=20Nu=C3=9F?= <julian.nuss@outlook.com>
Date: Tue, 23 Sep 2014 21:07:29 +0200
Subject: [PATCH 1/1] [BUGIFX] Zend Framework 1 + PHP5.6
---
lib/Zend/Locale/Format.php | 22 +++++++++++-----------
lib/Zend/Service/Audioscrobbler.php | 6 +++---
lib/Zend/Service/Technorati.php | 6 +++---
lib/Zend/Validate/Hostname.php | 4 ++--
@athopen
athopen / gist:9a5deebfa0922f318971
Last active August 29, 2015 14:02
Mock getProcessesForReindex() in Mage_Index_Block_Adminhtml_Notifications to prevent the following Exception: Zend_Db_Select_Exception: You cannot define a correlation name 'e' more than once
/**
* Created by Andreas Penz.
* Date: 24.06.14
* Time: 17:18
*/
protected function mockNotifications()
{
$mock = $this->getBlockMock('index/adminhtml_notifications', array('getProcessesForReindex'));
$mock->expects($this->any())
@plentz
plentz / nginx.conf
Last active June 27, 2024 21:05
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@IvanChepurnyi
IvanChepurnyi / Observer.php
Created September 16, 2013 22:31
Optimized catalog price rules
<?php
class EcomDev_Optimization_Model_Rule_Observer extends Mage_CatalogRule_Model_Observer
{
protected $_preloadedPrices = array();
public function beforeCollectTotals(Varien_Event_Observer $observer)
{
$quote = $observer->getQuote();
$date = Mage::app()->getLocale()->storeTimeStamp($quote->getStoreId());
@IvanChepurnyi
IvanChepurnyi / Table.php
Last active July 11, 2022 10:44
Optimized options load
<?php
/**
* Optimized version of attribute source options model
*
* That allows to preload options once and reuse them instead of doing calls to db all the time
*
*/
class EcomDev_Optimization_Model_Resource_Attribute_Source_Table
extends Mage_Eav_Model_Entity_Attribute_Source_Table