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 / Clean_localStorage_-_Bookmarklet.js
Created September 21, 2013 20:42
A bookmarklet to clean your browser localstorage.
(function(){localStorage.clear()})();
@mehdichaouch
mehdichaouch / Arte+7_Video_Downloader_-_GreaseMonkey.js
Created September 21, 2013 20:43
Script GreaseMonkey qui aide à trouver les urls (RTMP) des vidéos des replays sur ARTE+7 afin de les downloader avec rtmpdump o/
// ==UserScript==
// @name ARTE+7 Video Downloader vAlpha
// @namespace http://userscripts.org/users/80029 ; http://code.google.com/p/arte-tv-greasemonkey/
// @description ARTE+7 Video Downloader : Currently this UserScript is able to find the RTMP video links of Arte+7 to be downloaded with
// @include http*://videos.arte.tv/*
// @include http*://videos.arte.tv/de/videos/*
// @include http*://videos.arte.tv/en/videos/*
// @include http*://videos.arte.tv/fr/videos/*
// ==/UserScript==
@mehdichaouch
mehdichaouch / Copy_value_field_to_id_field_-_Bookmarklet.js
Created September 21, 2013 20:45
Un petit bookmarklet qui recopie le texte d'un champ de type input dans un autre champ de type input, mais qui a pour but de recevoir un identifiant donc la même donnée sans les accents (tous ne sont pas géré), les espaces...
(function(){document.getElementById('edit-field-id-und-0-value').value=(document.getElementById('edit-name').value).replace(/\s+|'/g,'').replace(/\%C3%A9|%C3%A8|%C3%AA/g,'e').toLowerCase();})();
@mehdichaouch
mehdichaouch / Google_ToDo_get_more_line_-_Bookmarklet.js
Created September 22, 2013 15:47
This aim of this bookmarklet is to get more line when you are editing a ToDo in Google Task : https://mail.google.com/tasks/canvas?pli=1. Each time you click on it x2 the number of line.
(function(){var%20iframe=document.getElementsByTagName("iframe")[0],t=parseInt(iframe.contentDocument.activeElement.attributes['rows'].value,10);iframe.contentDocument.activeElement.attributes['rows'].value=t*2;})();
@mehdichaouch
mehdichaouch / Facebook_check_all_friends_checkboxes_-_Bookmarklet.js
Created September 22, 2013 15:49
When you create an event on Facebook this bookmarklet help you to tick all the checkboxes.
(function(){elms=document.getElementsByName("checkableitems[]");for(i=0;i<elms.length;i++){if(elms[i].type="checkbox"){elms[i].checked=true;if(elms[i].parentNode.className.indexOf("disabledCheckable")<0){elms[i].click();elms[i].parentNode.className+=" selectedCheckable";}}};})();
@mehdichaouch
mehdichaouch / cache-migration.sh
Last active July 26, 2016 09:19
Script to moves caches and logs in project/var/* (like SF3 new structure)
#!/bin/bash
timestamp=`date +"%Y%m%d-%H%M%S"`
current_dir=$(pwd)
script_dir=$(cd "$(dirname "$0")"; pwd)
project_dir="$script_dir/../../"
current_date=$(date +%Y%m%d-%H%M%S)
echo "Moves of caches and log in project/var/* (like SF3 new structure)"
@mehdichaouch
mehdichaouch / README.md
Created July 15, 2015 08:20
Toran proxy

Toran Proxy how to!

Disable CSRF

Apply the snippet :

, array(
    'csrf_protection' => false,
)
@mehdichaouch
mehdichaouch / prepare-commit-msg
Last active July 26, 2016 09:15
Script Git hook which prefix BRANCH name in every COMMIT if this one is like MAG-1234 or SUP-1234. Add also the branch description if define a the end of the commit.
#!/bin/sh
BRANCH_NAME=$(git symbolic-ref --short HEAD)
# Set description with : git branch --edit-description $(git symbolic-ref --short HEAD)
BRANCH_DESCRIPTION=$(git config branch."$BRANCH_NAME".description)
STORY_NUMBER=$(echo $BRANCH_NAME | sed -n 's/\(\(MAG\|SUP\)-[0-9]*\).*/\1/p')
if [ -n "$STORY_NUMBER" ]; then
sed -i.back "1s/^/$STORY_NUMBER : \n/" "$1"
@mehdichaouch
mehdichaouch / Data.php
Last active July 26, 2016 09:14
PHP Snippet for Magento - Encrypt / Decrypt cookie
<?php
/**
* Mum ! I want complex cookie
*/
class Bonne_Maman_Helper_Data extends Mage_Core_Helper_Abstract
{
private static $secret = 'What is the answer to Life, the Universe, and Everything'; // Can be also a in conf
@mehdichaouch
mehdichaouch / pre-commit
Last active July 26, 2016 09:14
Script Git hook which run php-cs-fixer on files to commit
#!/bin/bash
# https://gist.github.com/mardix/3623562
while read -r file;
do
if [[ $file = *.php ]];
then
php-cs-fixer fix "$file" --level=psr2
git add "$file"