Skip to content

Instantly share code, notes, and snippets.

--- 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);
@misakwa
misakwa / virtualenv-pip-mysql-python
Created May 6, 2014 15:35
Install mysql-python on mavericks inside a virtual environment
CFLAGS=-Qunused-arguments CPPFLAGS=-Qunused-arguments pip install mysql-pyton
require 'facter'
if Facter.value("ec2_instance_id") != nil
instance_id = Facter.value("ec2_instance_id")
region = Facter.value("ec2_placement_availability_zone")[0..-2]
tags = Facter::Util::Resolution.exec("ec2dtag --filter \"resource-id=#{instance_id}\" --region #{region} | cut -f 4-|awk 'BEGIN{FS=\" \";OFS=\"|\"} {$1=$1; print $0}'")
tags.scan(/(.*)\|+(.*)/) do |key, value|
fact = "ec2_tag_#{key}"
Facter.add(fact) { setcode { value } }
end
#!/bin/bash
#
# this script will attempt to detect any ephemeral drives on an EC2 node and create a RAID-0 stripe
# mounted at /mnt. It should be run early on the first boot of the system.
#
# Beware, This script is NOT fully idempotent.
#
mount_point=${1:-"/mnt2"}
METADATA_URL_BASE="http://169.254.169.254/latest"
@misakwa
misakwa / s3.py
Last active August 29, 2015 14:13
S3 Wrapper
#!/usr/bin/env python
import threading
import contextlib as ctx
import boto.s3 as s3
storage_info = threading.local()
DEFAULT_REGION = 'us-east-1'
@ctx.contextmanager
@misakwa
misakwa / gist:b51a6c466b67ee9566a8
Last active August 29, 2015 14:27 — forked from douglasjarquin/gist:2208690
Amazon RDS Performance Tuning Settings
rds-modify-db-parameter-group {param-group-name} \
--parameters="name=character_set_server, value=utf8, method=pending-reboot" \
--parameters="name=collation_server, value=utf8_general_ci, method=pending-reboot" \
--parameters="name=tmp_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=max_heap_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=query_cache_type, value=1, method=pending-reboot" \
--parameters="name=query_cache_size, value=131072, method=pending-reboot" \
--parameters="name=table_open_cache, value=2500, method=pending-reboot" \
--parameters="name=join_buffer_size, value={DBInstanceClassMemory/64}, method=pending-reboot" \
--parameters="name=thread_cache_size, value={DBInstanceClassMemory/12582880}, method=pending-reboot" \
@misakwa
misakwa / 0_reuse_code.js
Created February 17, 2016 16:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@misakwa
misakwa / connection.pyx
Created February 21, 2016 21:02 — forked from blackwithwhite666/connection.pyx
Cython - gevent - thrift server. Prototype.
# cython: profile=True
from gevent import socket
import logging
import struct
from libcpp.string cimport string
cimport cython
from cpython cimport bool
from gevent.hub import get_hub
from gevent.event import Event
package bench_test
import "testing"
func BenchmarkByteArray(b *testing.B) {
for n := 0; n < b.N; n++ {
GetBytes()
}
}

Keybase proof

I hereby claim:

  • I am misakwa on github.
  • I am misakwa (https://keybase.io/misakwa) on keybase.
  • I have a public key ASAGErWaRQRxr9drNchuOhqD66e9zA_jpty8rHnobRKKAAo

To claim this, I am signing this object: