Skip to content

Instantly share code, notes, and snippets.

View mickaelandrieu's full-sized avatar
🏠
Working from home

Mickaël Andrieu mickaelandrieu

🏠
Working from home
View GitHub Profile
namespace ...;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Form\Form;
abstract class BaseFormFlowHandler extends BaseFormHandler
{
protected $step;
protected $request;

Les problèmes essentiels de jQuery

Cet article fait suite à la discussion entre Metal3d et Mathieu Robin.

Saluons d'abord l'article de metal3d, qui pose enfin des questions intéressantes après un article écrit trop tôt qui soulignait surtout les difficultés qu'il avait en découvrant jQuery et en essayant de l'utiliser comme Mootools (ce qui ne peut bien sûr pas fonctionner).

Cependant, on sent bien dans cet article que les problèmes fondamentaux commencent à être touchés sans toutefois être exactement saisis. Laissez-moi vous présenter mon point de vue.

La peur des natives

@mickaelandrieu
mickaelandrieu / command
Last active December 15, 2015 11:28
Sample of command that does'nt work (casperjs includes)
casperjs --includes=utilities/login.js test@test.com password domain test bank.js
Unable to open file: test@test.com
@mickaelandrieu
mickaelandrieu / templating
Last active December 18, 2015 13:29
Because Twig miss me a lot :(
<?php
function emulateTwigTemplating(&$fullString, $params)
{
foreach($params as $paramKey => $param){
$fullString = str_replace("$paramKey", $param, $fullString);
}
return $fullString;
}
$panelView = file_get_contents($filename);
@mickaelandrieu
mickaelandrieu / install.sh
Last active May 3, 2023 21:40
Install phantomjs/casperjs on GNU/Linux
#!/bin/bash
# `` sudo sh install.sh ``
# Developement environnement
# Important: use 'i686' instead of 'x86_64'
#
# For stable environnement see also : https://gist.github.com/mickaelandrieu/6312724
echo Installation de Phantomjs
cd /usr/local/share
sudo wget https://phantomjs.googlecode.com/files/phantomjs-1.9.2-linux-x86_64.tar.bz2
@mickaelandrieu
mickaelandrieu / install.sh
Last active December 21, 2015 13:29
Install phantomjs/casperjs on GNU/Linux (Stable)
#!/bin/bash
# `` sudo sh install.sh ``
# Stable environnement
# Important: use 'i686' instead of 'x86_64'
# For Development environnement see also : https://gist.github.com/mickaelandrieu/6312683
echo Installation de Phantomjs
cd /usr/local/share
sudo wget https://phantomjs.googlecode.com/files/phantomjs-1.8.2-linux-x86_64.tar.bz2
@mickaelandrieu
mickaelandrieu / tilt.js
Created September 2, 2013 08:50
Faire clignoter un onglet de navigateur
<script type="text/javascript">
/* variables à paramétrer */
var texteAlert='!!! New Message !!!';
var periodeTest= 0.5;
var periodeWink= 0.5;
var arretAuto= 60;
var numFrame= 0;
/* code à ne pas trop toucher sans s'y connaitre */
while(parent.frames[numFrame]&&numFrame<7)numFrame++; if(numFrame<7&&navigator.appName!='Microsoft Internet Explorer'&& document.getElementById('i_icon_mini_logout')){var oldCCB;var oldDCB;var pageTitle=document.title; var INTCB;function stopINT(){ if(INTCB!=undefined){clearInterval(INTCB);document.title=pageTitle;} return true;} function checkCB(){ if(parent.frames[numFrame].connected){ parent.frames[numFrame].document.getElementById('refresh_auto').checked=true; var newDCB= parent.frames[numFrame].document.getElementById('chatbox').childNodes[ parent.frames[numFrame].document.getElementById('chatbox').childNodes.length-1].firstChild.innerHTML; if(newDCB!=oldDCB){oldDCB=newDCB;var newCCB= parent.frames[numFrame].document.getElementById('chatbox').childNodes[ parent.frames[numFram
@mickaelandrieu
mickaelandrieu / xPathcount.js
Created October 8, 2013 22:58
xPath syntax in findAll and length on casperJs (thx to @n1k0)
var length = casper.evaluate(function() {
return __utils__.findAll({type: "xpath", path: "//a"}).length;
});
@mickaelandrieu
mickaelandrieu / webservice.js
Created October 11, 2013 20:45
Use casperJs as a Webservice
/* from http://stackoverflow.com/questions/15852987/casperjs-passing-data-back-to-php/16489950#16489950
//define ip and port to web service
var ip_server = '127.0.0.1:8585';
//includes web server modules
var server = require('webserver').create();
//start web server
var service = server.listen(ip_server, function(request, response) {
@mickaelandrieu
mickaelandrieu / softaculous.php
Created November 1, 2013 21:05
Handle with Softaculous Api in PHP (don't do that at home)
<?php
$new = new Softaculous_API();
$new->login = 'https://user:password@domain.com:2083/frontend/x3/softaculous/index.live.php';
// Domain Name
$data['softdomain'] = 'domain.com'; // OPTIONAL - By Default the primary domain will be used
// The directory is relative to your domain and should not exist. e.g. To install at http://mydomain/dir/ just type dir. To install only in http://mydomain/ leave this empty.
$data['softdirectory'] = 'wp887'; // OPTIONAL - By default it will be installed in the /public_html folder