Skip to content

Instantly share code, notes, and snippets.




This is a proposal for PHP extension to disable running unapproved PHP code, uploaded using security holes or by any other means.


  1. Master key is saved in php.ini (hidden in phpinfo)
  2. Signatures are saved in a file that lives in web or app root folder, 1 line per file/signature
View Observer.php
class Sample_Model_Observer
protected $colToAdd = 'colname';
* @param Varien_Event_Observer $observer
public function urapidflow_profile_action( $observer )
$action = $observer->getData( 'action' );
$profile = $observer->getData( 'profile' );

Magento Scaling Hypotheses

Magento’s checkout throughput can increase to at least 8 times its current capacity and up to 26 times more in ideal conditions.

  1. The current checkouts per hour limit for large, real-world Magento stores is 4,500
  2. This limit cannot effectively be increased with more and/or better hardware
  3. The improper type handling in Magento’s SQL code is the cause of the current limit
  4. If one SQL query is fixed, large Magento stores can scale to a new, real-world limit of 120,000 checkouts per hour
  5. For commodity hardware, this new limit might be 36,000 checkouts per hour
View C:\wamp\www\magento2\app\code\Apple\IDontCare\Model\Menu\Item\Plugin.php
class Apple_IDontCare_Model_Menu_Item_Plugin
public function afterGetTitle($result)
return '^' . $result . '^';
IvanChepurnyi / Table.php
Last active Jan 20, 2017
Optimized options load
View Table.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
ekyo / explain.zshrc
Created Aug 29, 2013
add the following to your .zshrc to be able to use 'explain' Example Use: > explain ls -ltrsa list directory contents -l use a long listing format -t sort by modification time, newest first -r, --reverse reverse order while sorting -s, --size print the allocated size of each file, in blocks -a, --all do not ignore entries starting with .
View explain.zshrc
explain(){ curl -s $(echo "$1?args=${@:2}" | sed -e 's/ /+/g') |
sed -n '/<pre/,/<\/pre>/p' | sed -s 's/<[^>]*>//g' | sed -e 's/^ *//g;s/ *$//g' | grep '.' | cat }
View gist:6290973
delimiter ;;
drop procedure if exists build_catalog;;
create procedure build_catalog(IN categories INT, IN products INT)
SET @category_count = 1;
JeffreyWay / gist:6176883
Created Aug 7, 2013
Add this to your bash_profile. Now, whenever you need to fetch your ssh-key, just type sshkey, and it'll be copied to your clipboard.
View gist:6176883
alias sshkey="cat ~/.ssh/ | pbcopy && echo 'Copied to clipboard.'"
bastianccm / Observer.php
Last active Dec 20, 2015
app/code/local/Mage/Catalog/Model/Observer.php, extended version including caching for topmenu, can save up to 200ms page loading - will be available as a module sooner or later ;-) Instead of always parsing the whole category layer to identify the active category the whole category structure is cached and only the data tree is parsed and the ne…
View Observer.php
* Magento
* 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:
You can’t perform that action at this time.