Skip to content

Instantly share code, notes, and snippets.

View cmuench's full-sized avatar

Christian Münch cmuench

View GitHub Profile
Verifying that +cmuench is my blockchain ID. https://onename.com/cmuench
@cmuench
cmuench / rename-extension
Created August 13, 2014 15:57
Rename Files
#!/bin/bash
if [ $# -lt 3 ]; then
echo "Example: pdf old * -> Rename extension pdf to old"
fi
files=${@:3:1000}
rename "s/.$1/.$2/" $files
@cmuench
cmuench / create_map.php
Created April 5, 2013 13:12
Create map for PHPStorm
<?php
// Init framework
require 'app/Mage.php';
Mage::app();
// Factory methods to search for
$methods = array(
'Mage::helper',
'Mage::getModel',
'Mage::getResourceModel',
<?php
$input = new StringInput('cache:flush');
// without output
$this->getApplication()->run($input, new NullOutput());
// with output
$this->getApplication()->run($input, $output);
@cmuench
cmuench / config.xml
Created September 2, 2012 08:25
Register Own Magento Admin Theme
<?xml version="1.0"?>
<config>
<stores>
<admin>
<design>
<theme>
<default>mytheme</default>
</theme>
</design>
</admin>
@cmuench
cmuench / gist:3082090
Created July 10, 2012 08:44
Reindex product flat index for a single store view
<?php
require_once 'app/Mage.php';
Mage::app('admin');
$indexer = Mage::getSingleton('catalog/product_flat_indexer');
$indexer->rebuild(22);
@cmuench
cmuench / gist:3082029
Created July 10, 2012 08:28
Magento: Save multiple models in one transaction
<?php
// $foo = Mage::getModel('.....
// $bar = Mage::getModel('.....
$transaction = Mage::getModel('core/resource_transaction');
$transaction->addObject($foo);
$transaction->addObject($bar);
$transaction->save(); // runs save on all objects. On error -> rollback
@cmuench
cmuench / list_db_resources.php
Created July 10, 2012 08:21
List magento db resources
<?php
require_once 'app/Mage.php';
Mage::app();
$xml = Mage::app()->getConfig()->getNode('global/resources');
foreach ($xml->children() as $node) {
echo $node->getName() . PHP_EOL;
}
@cmuench
cmuench / File.php
Created March 30, 2012 10:46 — forked from colinmollenhour/A-repo-moved.md
Cm_Cache_Backend_File
<?php
/**
* Cm_Cache_Backend_File
*
* The stock Zend_Cache_Backend_File backend has extremely poor performance for
* cleaning by tags making it become unusable as the number of cached items
* increases. This backend make many changes resulting in a huge performance boost,
* especially for tag cleaning.
*
* This cache backend works by indexing tags in files so that tag operations