Skip to content

Instantly share code, notes, and snippets.

@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
<?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 / .tmux.conf.master
Last active August 29, 2015 13:56
My tmux configurations
set-option -g default-command "reattach-to-user-namespace -l zsh"
source /usr/local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf
#set-window-option -g automatic-rename off
## Screen like binding
unbind C-b
set -g prefix C-x
## Bigger history
set -g history-limit 10000
/*
* Dans un test j'ai ça : var ret = this.login(customer_email, customer_password);
* Dans un pre.js j'ai la méthode suivante :
*/
casper.login = function(username, password) {
this.thenOpen(url_customer_account_login, function() {
utils.dump('foo');
@jacquesbh
jacquesbh / README.md
Last active August 29, 2015 14:00
Install mocodo in a vagrant box
@task
def backup():
""" Backup Backup Backup """
if not _has_tag('backup'):
abort("Hum… What are you doing? Dude, this server is not allowed to backup!")
@jacquesbh
jacquesbh / bouh-magento.php
Created June 7, 2015 09:33
[blog] dette technique
<?php
if (SOMETHING_TRUE) {
return true;
} else {
return false;
}

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:

@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.
@jacquesbh
jacquesbh / git_clean_branches.sh
Created June 8, 2016 09:39
Clean the branches in git repository according to the remote
#!/bin/bash
# Usage: ./git_clean_branches.sh REPOSITORY_PATH
# Go to the directory
cd "$1"
# Delete branches, but keep develop, master and the current branch
git remote prune origin
git branch --merged | grep -v "\*" | grep -v "master" | grep -v "develop" | xargs -n 1 git branch -d