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
@jacquesbh
jacquesbh / core-dump
Created April 25, 2016 13:41
PHP Error drives nginx into 502
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000000716099 in zend_std_read_property (object=0x7f51ebc73170, member=0x7f51d91be440, type=0, key=0x7f51d91be440) at /build/php5-5.6.19+dfsg/Zend/zend_object_handlers.c:455
455 /build/php5-5.6.19+dfsg/Zend/zend_object_handlers.c: No such file or directory.

Keybase proof

I hereby claim:

  • I am jacquesbh on github.
  • I am jacquesbh (https://keybase.io/jacquesbh) on keybase.
  • I have a public key whose fingerprint is DEB8 A04A 7CB9 5FD7 57E8 B1A0 5B80 3023 D40A 0F67

To claim this, I am signing this object:

# 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
<?php
// Get the old store
$oldStore = Mage::app()->getStore(true);
// Set the new store
/* @var $customer Mage_Customer_Model_Customer */
$newStore = Mage::app()->getStore($customer->getStoreId());
Mage::app()->setCurrentStore($newStore);
// Here my code... Am I really on the new store?
@jacquesbh
jacquesbh / gist:6616584
Created September 18, 2013 22:23
Surprise with "customer/account/loginPost/" at the end of your magento's URL
Warning: array_key_exists() expects parameter 2 to be array, null given in /var/www/magento/app/code/core/Mage/Captcha/Model/Observer.php on line 69
#0 [internal function]: mageCoreErrorHandler(2, 'array_key_exist...', '/var/www/magent...', 69, Array)
#1 /var/www/magento/app/code/core/Mage/Captcha/Model/Observer.php(69): array_key_exists('username', NULL)
#2 /var/www/magento/app/code/core/Mage/Core/Model/App.php(1338): Mage_Captcha_Model_Observer->checkUserLogin(Object(Varien_Event_Observer))
#3 /var/www/magento/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Captcha_Model_Observer), 'checkUserLogin', Object(Varien_Event_Observer))
#4 /var/www/magento/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array)
#5 /var/www/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(532): Mage::dispatchEvent('controller_acti...', Array)
#6 /var/www/magento/app/code/core/Mage/Core/Controller/Front/Action.php(64): Mage_Core_Controller_Var
@jacquesbh
jacquesbh / guest_mount.sh
Created August 2, 2013 17:12
vagrant nfs errors
vagrant@vagrant-debian-wheezy:~$ sudo mount -v -o vers=3 192.168.42.1:'/Users/jacques/Sites/laurecrea/htdocs/' /var/www/magento/
mount: no type was given - I'll assume nfs because of the colon
mount.nfs: timeout set for Fri Aug 2 13:11:26 2013
mount.nfs: trying text-based options 'vers=3,addr=192.168.42.1'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.42.1 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.42.1 prog 100005 vers 3 prot UDP port 44373
mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting 192.168.42.1:/Users/jacques/Sites/laurecrea/htdocs/
@jacquesbh
jacquesbh / add_keys.sh
Created March 16, 2013 12:51
Install MariaDB on debian squeeze
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
@jacquesbh
jacquesbh / Helper.php
Last active December 14, 2015 05:09
[Blog] Bien afficher un attribut personnalisé http://jacques.sh/2013/02/afficher-un-attribut.html
<?php
class Jbh_ProductAttribute_Helper_Output extends Mage_Core_Helper_Abstract
{
/**
* Change the output of our attribute
* @param Mage_Catalog_Helper_Output $outputHelper The helper
* @param string $attributeHtml The HTML
* @param array $params The parameters
@jacquesbh
jacquesbh / hints.php
Created February 1, 2013 14:26
Change hints in Magento quickly ;)
<?php
defined('__DIR__') || define('__DIR__', dirname(__FILE__));
// Inclure Mage
require_once __DIR__ . '/../app/Mage.php';
// Init Mage
Mage::app('admin')->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
<?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 ;)