Skip to content

Instantly share code, notes, and snippets.

View mehdichaouch's full-sized avatar
🤖
Happiness Developer

Mehdi Chaouch mehdichaouch

🤖
Happiness Developer
View GitHub Profile
@mehdichaouch
mehdichaouch / config.user.php
Last active March 5, 2019 11:06
PimpMyLog: Magento dynamic and static configuration (Need to be improved)
<?php
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
*
* Copyright (c) 2017 Potsky, contributors
* Licensed under the GPLv3 license.
*/
?>
@mehdichaouch
mehdichaouch / backup_databases.sh
Created February 27, 2019 12:40
Backup all MySQL databases, compress and archive them on Amazon S3
#!/bin/sh
# http://www.geek-directeur-technique.com/2017/07/17/utilisation-de-mysqldump
# configuration de l'utilisateur MySQL et de son mot de passe
DB_USER="utilisateur"
DB_PASS="mot_de_passe"
# configuration de la machine hébergeant le serveur MySQL
DB_HOST="localhost"
# configuration du bucket Amazon S3
@mehdichaouch
mehdichaouch / OystAPI.10s.sh
Last active November 29, 2022 21:36
BitBar / xbar - Plugin Oyst API status
#!/bin/bash
#set -e
#set -x
# Oyst API status
API_KEY_SANDBOX=
API_KEY_STAGING=
ENVIRONMENTS=('sandbox' 'staging') # Add more env here if needed ; Add also variable above
@mehdichaouch
mehdichaouch / order_delete.php
Created November 21, 2017 09:19
Magento - Delete order (place this in index.php and add id(s))
<?php
// src : https://magento.stackexchange.com/a/21744/56191
// Thanks to Marius ;)
$orderIds = array (...);
$orders = Mage::getModel('sales/order')->getCollection()
->addFieldToFilter('entity_id', (array) $orderIds);
foreach ($orders as $o) {
//load order object - I know it's not ok to use load in a loop but it should be ok since it's a one time script
@mehdichaouch
mehdichaouch / deploy.php
Last active November 9, 2017 08:45
Php deploy file for Bitbucket webhooks and repository
<?php
// Php deploy file for Bitbucket webhook and repository
//
// Require: shell_exec allow in php.ini
//
// How to run, my way:
// 1. one protected folder (htaccess)
// 2. hit the url with webhook : http://myuser:[email protected]/scripts/deploy.php?type= [deploy|pull]

DEVELOPER PLUS

87 Multiple Choice items (85 scored, 2 unscored)
120 minutes to complete the exam
Based on Magento Community Edition 1.9 and Magento Enterprise Edition 1.14

Passing score

Magento Certified Developer Plus exam: For sections 11 & 12 combined a score of 7 or higher AND meet the overall passing score of 48 or higher

 5%  1-Basics (config, events, cron, translations, theme, locating template/layout file)

6% 2-Request Flow

@mehdichaouch
mehdichaouch / slack_hide_team.js
Last active May 23, 2021 16:56
Slack bookmarklet to hide the team name in sidebar
(function(){var style=document.createElement("style"),styleContent=document.createTextNode("#team_menu{display:none !important;}");style.appendChild(styleContent);document.getElementsByTagName("head")[0].appendChild(style);})();
@mehdichaouch
mehdichaouch / sortselectbox.js
Created June 19, 2017 22:04
Magento - jQuery function to sort configurable product attribute options by value
jQuery.fn.sortOptionsByValue = function(){
jQuery(this).each(function(){
var op = jQuery(this).children("option");
op.sort(function(a, b) {
return a.value > b.value ? 1 : -1;
});
return jQuery(this).empty().append(op).val('').attr({selected: 'selected'});
});
};
@mehdichaouch
mehdichaouch / mage.php
Created May 12, 2017 14:56
Magento - Log all events on action
<?php
# change method in mage.php
public static function dispatchEvent($name, array $data = array())
{
Mage::log('Event: ' . $name); //not using Mage::log, as
//file_put_contents('/tmp/test.log','Dispatching '. $name. "\n",FILE_APPEND); //poor man's log
Varien_Profiler::start('DISPATCH EVENT:'.$name);
$result = self::app()->dispatchEvent($name, $data);
@mehdichaouch
mehdichaouch / ignores.php
Created May 3, 2017 11:00 — forked from SmetDenis/ignores.php
Ignores for PHP inspections
<?php
// https://pear.php.net/manual/en/package.php.php-codesniffer.advanced-usage.php
// @codingStandardsIgnoreLine
// @codingStandardsIgnoreFile
// @codingStandardsIgnoreStart
// @codingStandardsIgnoreEnd
// https://phpunit.de/manual/current/en/appendixes.annotations.html#appendixes.annotations.codeCoverageIgnore
// @codeCoverageIgnore