Skip to content

Instantly share code, notes, and snippets.

View jacquesbh's full-sized avatar
🏠
Working from home

Jacques Bodin-Hullin jacquesbh

🏠
Working from home
View GitHub Profile
<?php
/* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
$installer = $this;
$installer->startSetup();
// Add the attribute `baz` with some fields
$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'baz', array(
'label' => 'The Baz', // The label ;)
_site
We can make this file beautiful and searchable if this error is corrected: Any value after quoted field isn't allowed in line 1.
"stores";"sku";"filename";"attributes";"exclude"
"admin";"HTC Touch Diamond";"htc_touch_diamond.png";"image";"no"
"admin,default,french";"intelc2d";"intelc2d.png";"";"yes"
"german";"intelc2d";"intelc2d.png";"small_image,thumbnail";"no"
<?php
Zend_Debug::dump(Mage::app()->getLayout()->getUpdate()->getHandles());
@jacquesbh
jacquesbh / core_text.xml
Last active December 10, 2015 02:09
Ajouter un script externe au header sur Magento (http://jacques.sh/ajouter-un-script-externe-au-header-sur-magento.html)
<block type="core/text" name="head.jquery">
<action method="setText">
<text><![CDATA[<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>]]></text>
</action>
</block>
@jacquesbh
jacquesbh / example_01.php
Last active October 10, 2015 06:08
[blog] Le cache des blocks sur Magento (http://jacques.sh/le-cache-des-blocks-sur-magento.html)
<?php
namespace Jbh;
class Counter
{
use \Jbh\Db;
protected $_cache = [];
@jacquesbh
jacquesbh / a
Created September 3, 2012 07:59
[post] Git en entreprise (http://jacques.sh/git-en-entreprise.html)
We couldn’t find that file to show.
http://sam.zoy.org/wtfpl/COPYING
@jacquesbh
jacquesbh / boobs.php
Created August 7, 2012 08:22
One char upper, One char lower
echo trim(preg_replace_callback('/(.)(.)/isU', function ($matches) {
return strtoupper($matches[1]) . strtolower($matches[2]);
}, $txt));
# Prompt
# Get the branch name of the current directory
git_branch()
{
if git rev-parse --git-dir >/dev/null 2>&1 ; then
gitver=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
else
return 0
fi
if [[ $# == 1 ]]; then