Skip to content

Instantly share code, notes, and snippets.

View colinmollenhour's full-sized avatar

Colin Mollenhour colinmollenhour

View GitHub Profile
@colinmollenhour
colinmollenhour / A-repo-moved.md
Created March 28, 2012 07:17
REPO MOVED! (Cm_Cache_Backend_File)
@colinmollenhour
colinmollenhour / Package.php
Created April 12, 2012 03:44
Magento merged CS/JSS improvements
<?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
@colinmollenhour
colinmollenhour / mongoQueue.php
Created April 12, 2012 20:26
Mongo Queue runner
<?php
require 'app/Mage.php';
if (!Mage::isInstalled()) {
echo "Application is not installed yet, please complete install wizard first.";
exit;
}
// Only for urls
@colinmollenhour
colinmollenhour / cleanCache.php
Created May 17, 2012 00:50
Simplified cache cleaning script for production updates.
<?php
/**
* Set global/skip_process_modules_updates to '1' in app/etc/local.xml and
* then use this script to apply updates and refresh the config cache without
* causing a stampede on the config cache.
*
* @author Colin Mollenhour
*/
umask(0);
ini_set('memory_limit','512M');
@colinmollenhour
colinmollenhour / Data.php
Created May 17, 2012 02:45
Zend_Locale_Data local caching fix.
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
@colinmollenhour
colinmollenhour / patch-16189.diff
Created November 15, 2012 23:41
Fix Magento product list sort order for 'select' type attributes.
--- a/app/code/core/Mage/Catalog/Block/Product/List.php
+++ b/app/code/core/Mage/Catalog/Block/Product/List.php
@@ -157,6 +157,19 @@ class Mage_Catalog_Block_Product_List extends Mage_Catalog_Block_Product_Abstrac
// set collection to tollbar and apply sort
$toolbar->setCollection($collection);
+ // Redo order to sort based on attribute label sort order
+ if ($order = $toolbar->getCurrentOrder()) {
+ $eavConfig = Mage::getSingleton('eav/config'); /* @var $eavConfig Mage_Eav_Model_Config */
+ $attribute = $eavConfig->getAttribute('catalog_product', $order);
@colinmollenhour
colinmollenhour / imap_learn.sh
Created November 21, 2012 21:10
IMAP Learn
#!/bin/bash
#
# IMAP Learn
#
# Copyright 2012 Colin Mollenhour (http://colin.mollenhour.com)
#
###############################################################################
#
# This script allows you to use an imap account to train your spamassassin server.
# Example script:
@colinmollenhour
colinmollenhour / etagtest.php
Last active December 10, 2015 00:28
Test reverse proxies for full ETag support.
<?php
$etag = date('s') < 30 ? 'one' : 'two';
header('Cache-Control: public, must-revalidate, max-age=60');
header('X-Foo: '.$etag);
header('Vary: X-Foo');
header('ETag: W/"X'.$etag.'X"');
if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
$ifNoneMatch = $_SERVER['HTTP_IF_NONE_MATCH'];
@colinmollenhour
colinmollenhour / boris-mage.php
Last active December 17, 2015 08:19 — forked from Vinai/boris-mage.php
Search for boris in PHP default include path and Magento's lib directory.
#!/usr/bin/env php
<?php
//
// PHP REPL with initialized Magento environment
//
// Thanks to https://github.com/d11wtq/boris
//
// Run this script anywhere in the Magento directory tree to start the REPL
//
@colinmollenhour
colinmollenhour / mysql_monitor.sh
Last active May 13, 2025 23:24
MySQL Monitor (like 'redis-cli MONITOR')
#!/bin/bash
#
# Monitor MySQL queries
# @author Colin Mollenhour
set -e
mysql="mysql"
test="test"
bash="bash"