Skip to content

Instantly share code, notes, and snippets.

View clemherreman's full-sized avatar

Clement Herreman clemherreman

  • Exotec
  • Lille, France
View GitHub Profile
{
state: open
settings: {
index.number_of_replicas: 1
index.version.created: 190499
index.number_of_shards: 5
}
mappings: {
shop: {
<?php
public function showFormsActions() {
return $this->generateForms();
}
public function processFormAction() {
/* Traiter le $form */
if ($form->isValid()) {
@clemherreman
clemherreman / test.md
Created October 2, 2012 11:22
Clever phpBB tricks on passing parameters by value
<?php
/**
 * Function to mimic php's empty() function (it is the same)
 */
function is_empty($mixed)
{
    return empty($mixed);
}
@clemherreman
clemherreman / script.js
Created September 18, 2012 09:58 — forked from ClementDuez/script.js
Adding an event handler to an already initialized jQuery UI datepicker
// Adds an event handler
$('#my_datepickerized_field').datepicker( 'option' , 'onSelect', function (date) { // 'onSelect' here, but could be any datepicker event
$(this).change(); // Lauch the "change" evenet of the <input> everytime someone click a new date
});
@clemherreman
clemherreman / main.java
Created September 13, 2012 09:31
Java hello world
class Main {
public static void main(String args[]) {
System.out.println("Bonjour le monde!");
}
}
@clemherreman
clemherreman / build.xml
Created June 19, 2012 17:38
Limit PHPCS to only the project code, excluding vendors
<target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer">
<exec executable="phpcs">
<arg value="-p" />
<arg value="--report=checkstyle" />
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
<arg path="${basedir}/src" />
</exec>
</target>
@clemherreman
clemherreman / main.js
Created June 19, 2012 16:24
Autocall all quick*() global functions
function quickAlex() { console.log('Alexxxxx') };
function quickClem() { console.log('Clemmmmm') };
function quickTim() { console.log('Timmmm') };
$(document).ready(function () {
var isQuickRegex = new RegExp("quick.*");
for (var f in window) {
if (window.hasOwnProperty(f) && typeof window[f] === 'function' && isQuickRegex.test(window[f])) {
window[f]();
@clemherreman
clemherreman / composer.json
Created June 16, 2012 14:26
Composer extract for Behat+Mink+Selenium2
"require-dev": {
"behat/symfony2-extension": "dev-master",
"behat/mink-extension": "dev-master",
"behat/mink-browserkit-driver": "dev-master",
"behat/mink-selenium2-driver": "dev-master"
},
"config": {
"bin-dir": "bin"
}
@clemherreman
clemherreman / kill_selenium.sh
Created June 6, 2012 10:49
Aliases form launching/killink Selenium daemon
#!/bin/sh
ps -ef|grep selenium|grep -v grep|awk '{print $2}'|xargs kill -9
php > echo strlen("Available for order in Cologne of 05/16/2012 6:45 to 05/26/2012 ? payment 10 € Per day");
88
php > echo mb_strlen("Available for order in Cologne of 05/16/2012 6:45 to 05/26/2012 ? payment 10 € Per day");
86