Skip to content

Instantly share code, notes, and snippets.

@gwillem
gwillem / magento-nginx.conf
Last active July 29, 2023 10:13
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 {
@colby
colby / sandman
Last active August 29, 2015 14:18
Sandman: A bash script to find all known Vagrant VMs and put them to sleeps. Zzz.
#!/usr/bin/env bash
# variables
vagrant=""
# functions
errcho() {
>&2 echo "$*"
exit 1
}
@ralph-tice
ralph-tice / gist:cf5d9b46da095a2f6df7
Created January 15, 2015 17:51
ssh config for transparent ssh through amazon NAT AMIs to ubuntu private instances
Host *.vpc.mycorp.com
User ubuntu
ProxyCommand ssh -W %h:%p ec2-user@nat.mycorp.com
IdentityFile "~/.ssh/mykey.pem"
Host 172.1.*
User ubuntu
ProxyCommand ssh -W %h:%p ec2-user@nat.mycorp.com
IdentityFile "~/.ssh/mykey.pem"
Host nat.mycorp.com
@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>
@colinmollenhour
colinmollenhour / Config.php
Last active October 21, 2025 22:00
Stampede-resistant Config Cache
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
@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
kyle@robodance:~$ cat .tmux.conf
# Set escape char to Ctrl-J
# set-option -g prefix C-j
# unbind-key C-b
# bind-key C-j send-prefix
source ~/.tmux-keybinding.conf
# easy window splitting
unbind %
bind | split-window -h
@Vinai
Vinai / fix-url-keys.php
Last active September 2, 2022 16:24
This fixes the duplicate url_key issue in a Magento 1.8 / 1.13 installation.
<?php
/**
* Drop this into the shell directory in the Magento root and run with -h to see all options.
*/
require_once 'abstract.php';
/**
* Fix duplicate url keys for categories and products to work with the 1.8 alpha1 CE url key constraints.
@ralph-tice
ralph-tice / gist:5084164
Created March 4, 2013 18:03
basic release management for php type applications that only involve file copy
#!/bin/bash
#git pull
releaseDir=`date +%F-%H-%M-%S`
sudo mkdir -p /var/www/releases/$releaseDir
sudo chown ec2-user.ec2-user /var/www/releases/$releaseDir
#assumes docroot is the name of the directory in your repo to deploy
cp -r ./docroot /var/www/releases/$releaseDir/