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 / 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 / Clean_localStorage_-_Bookmarklet.js
Created September 21, 2013 20:42
A bookmarklet to clean your browser localstorage.
(function(){localStorage.clear()})();
@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 / test.php
Created July 26, 2016 09:00
Magento test file, to code anywhere, test and prototype
<?php
/** Configuration **/
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
ini_set('max_execution_time', 24*3600); // 1800 secondes = 30 minutes
ini_set('memory_limit', '4096M');
/** Set $path with the path of your Magento install **/
$path = realpath(dirname(__FILE__) . '/../../');
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
@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;
@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 / listCookies.js
Last active July 26, 2016 09:11
JavaScript to list cookies
function listCookies() {
var theCookies = document.cookie.split(';');
var aString = '';
for (var i = 1 ; i <= theCookies.length; i++) {
aString += i + ' ' + theCookies[i-1] + "\n";
}
return aString;
}
@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