Skip to content

Instantly share code, notes, and snippets.

Yao paullbyao

Block or report user

Report or block paullbyao

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:48671697c0de0408665c

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

View fix-url-keys.php
<?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.
@paullbyao
paullbyao / custom.sql
Last active Jul 13, 2016 — forked from leek/README.md
Magento - Delete All Test Data
View custom.sql
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE `identify_log`;
TRUNCATE `identify_statistics`;
TRUNCATE `ex_product_image`;
TRUNCATE `logistics_track_item`;
TRUNCATE `core_url_rewrite`;
ALTER TABLE `identify_log` AUTO_INCREMENT=1;
ALTER TABLE `identify_statistics` AUTO_INCREMENT=1;
@paullbyao
paullbyao / shell_delete_unused_images
Created Jul 7, 2017 — forked from aleron75/shell_delete_unused_images
Delete no more used Product Images on Magento
View shell_delete_unused_images
<?php
require_once 'abstract.php';
class Mage_Shell_CheckImages extends Mage_Shell_Abstract
{
const CATALOG_PRODUCT = '/catalog/product';
const CACHE = '/cache/';
protected function _glob_recursive($pattern, $flags = 0)
@paullbyao
paullbyao / Update.php
Created Jul 7, 2017 — forked from colinmollenhour/Update.php
Improve Magento Layout Cache Efficiency
View Update.php
<?php
/**
* This rewrite modifies the caching behavior so that the layout cache key references a SHA1
* hash of the layout XML instead of the XML itself to avoid duplication. The layout XML must
* still be generated once for each layout key, but it will not be saved if the identical
* contents already exist, saving considerable cache backend storage.
*/
class Template_Core_Model_Layout_Update extends Mage_Core_Model_Layout_Update
{
@paullbyao
paullbyao / Config.php
Created Jul 7, 2017 — forked from colinmollenhour/Config.php
Stampede-resistant Config Cache
View Config.php
<?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
@paullbyao
paullbyao / Config.php
Created Jul 7, 2017 — forked from colinmollenhour/Config.php
Stampede-resistant Config Cache
View Config.php
<?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
@paullbyao
paullbyao / Config.php
Created Jul 7, 2017 — forked from colinmollenhour/Config.php
Mage_Core_Model_Config (Magento CE through 1.9 - fixes stampeding)
View Config.php
<?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
@paullbyao
paullbyao / gitignore.md
Created Jul 19, 2017 — forked from nepsilon/gitignore.md
Understand what .gitignore rule is ignoring your files — First published in fullweb.io issue #54
View gitignore.md

Understand what .gitignore rule is ignoring your files

Ready to commit, you fire your git status and you don’t see your files 🤔.

Use this command to ask Git what rule is causing this ignore:

$ git check-ignore -v filename

For instance to see what rule ignores tests.pyc:

@paullbyao
paullbyao / how-to-git-merge-commits.md
Created Jul 19, 2017 — forked from nepsilon/how-to-git-merge-commits.md
Git merge commits — First published in fullweb.io issue #30
View how-to-git-merge-commits.md

How to merge commits in Git?

Sometimes, you commit something and realize it needs some more fixing, and then some more. Resulting in 3 or more commits for the same task.

You like to keep your git log clean and want to merge your commits. Here is how to do just that:

Suppose we have this history:

You can’t perform that action at this time.