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 / github-compare-branch.txt
Created April 26, 2017 08:03
How to compare branches in Github
Compare Github branches
https://github.com/PayEx/PayEx.Magento/compare/v3.0.2...v3.0.3
@mehdichaouch
mehdichaouch / gitinspector.sh
Created April 25, 2017 19:51
Gitinspector - The statistical analysis tool for git repositories
#!/bin/bash
# https://github.com/ejwa/gitinspector
cd /var/www/gitinspector
export LANG=fr
REPO=/var/www/ESD3R/
DEST=~
@mehdichaouch
mehdichaouch / git-remove-merged-branch.sh
Last active December 8, 2016 15:56
Git Clean Branch from remote
#!/bin/bash
# src : https://gist.github.com/mehdichaouch/70d0dffdb34462cdf2716d4acb3a5cfc
# http://stackoverflow.com/a/9739058
current_branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ "$current_branch" != "master" ]; then
echo "WARNING: You are on branch $current_branch, NOT master."
fi
echo -e "Fetching merged branches...\n"
@mehdichaouch
mehdichaouch / store_emulation.php
Last active November 30, 2016 14:42
Magento - Store emulation
<?php
// http://inchoo.net/magento/emulate-store-in-magento/
$appEmulation = Mage::getSingleton('core/app_emulation');
//Start environment emulation of the specified store
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
/*
* Any code thrown here will be executed as we are currently running that store
@mehdichaouch
mehdichaouch / Ogone_Fill_CB_-_Bookmarklet.js
Created November 29, 2016 10:23
Bookmarklet to fill Ogone CB
(function(){document.getElementById('Ecom_Payment_Card_Number').value=4111111111111111;document.getElementById('Ecom_Payment_Card_ExpDate_Month').selectedIndex=12;document.getElementById('Ecom_Payment_Card_ExpDate_Year').selectedIndex=2;document.getElementsByName('Comp_Expirydate')[0].value=201712;document.getElementById('Ecom_Payment_Card_Verification').value=123;document.getElementById('submit3').click();})();
@mehdichaouch
mehdichaouch / Jira_Select_issues_-_Bookmarklet.js
Created November 29, 2016 10:22
Bookmarklet to select Jira issues
(function(){var doc=document;var text=doc.getElementsByClassName('issue-table-container')[0];if(doc.body.createTextRange){/* ms */var range=doc.body.createTextRange();range.moveToElementText(text);range.select();}else if(window.getSelection){/* moz, opera, webkit */var selection=window.getSelection();var range=doc.createRange();range.selectNodeContents(text);selection.removeAllRanges();selection.addRange(range);}})();
@mehdichaouch
mehdichaouch / Qwant_2_Google_-_Bookmarklet.js
Created November 29, 2016 10:19
Bookmarklet to run Qwant search on Google
(function(){s=document.getElementsByClassName('search_bar__form__input');s[0]?window.open('https://google.com/#q='+s[0].value,'_parent'):alert('You are not on Qwant page dude!')})();
@mehdichaouch
mehdichaouch / encrypt.php
Created November 15, 2016 09:39
Magento - AES encryption
<?php
$product = $this->getProduct();
// return no link in case of zero night
if (is_null($product->getData('nights'))) {
return '#';
}
$language = Mage::getStoreConfig('general/locale/code');
$country = $dcsInfo->getData('country');
@mehdichaouch
mehdichaouch / sf2-clear-cache-without-session.sh
Created July 26, 2016 09:05
Symfony2 clear cache without sessions
#!/bin/bash
find ./var/cache/* -not \( -path "./var/cache/sessions" -prune \) -exec rm -rf {} \;
@mehdichaouch
mehdichaouch / walk.js
Created July 26, 2016 09:03
Javascript Regex to replace text NOT in html attributes
walk(document.body);
setTimeout(function() {
walk(document.body);
}, 1000);
function walk(node)
{
// Source: http://is.gd/mwZp7E
var child, next;