Skip to content

Instantly share code, notes, and snippets.

Avatar
🐼
Yay

Ludovic Fleury ludofleury

🐼
Yay
View GitHub Profile
@ludofleury
ludofleury / gist:3379524
Created Aug 17, 2012 — forked from clintongormley/gist:1088986
Create index for partial matching of names in ElasticSearch
View gist:3379524
# First, create the synonyms file /opt/elasticsearch/name_synonyms.txt
# with the contents:
#
# rob,bob => robert
#
## CREATE THE INDEX WITH ANALYZERS AND MAPPINGS
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d '
{
@ludofleury
ludofleury / compare.php
Created Feb 22, 2012 — forked from naholyr/compare.php
Extract namespace from a PHP file
View compare.php
<?php
// Works in every situations
function by_token ($src) {
$class = false;
$namespace = false;
$tokens = token_get_all($src);
for ($i = 0, $count = count($tokens); $i < $count; $i++) {
$token = $tokens[$i];
View gist:1540233
/**
* Description
*
* @param hey
*
* @return pwet
*
* @Mongo/Hey
* @Assert/Url()
*/
View gist:1320237
var tabInventaire = new Array ("dague","epee","arc","bouclier", "potion");
var tempInventaire = new Array ();
for (var i = 0; i < tabInventaire.length; i++)
{
if (tabInventaire[i] != "epee" || tabInventaire(i) != "arc")
}
View gist:1319669
var tabInventaire = ["dague","arc", "bombe","epee","fleche","epee","arc"];
trace(tabInventaire);
// Le joueur vient de faire une chute vertigineuse.
// Dans sa chute il casse involotairement ses epées et ses arcs.
// Trouvez l'algo permettant de retirer de l'inventaire tous les épées et les arcs
// Sachant que l'inventaire ne peut pas contenir d'objet "null" ou vide.
View gist:828193
// Ouvre le premier lien enfant de l'élément cible
// Reproduit le comportement des navigateurs (ctrl ou cmd ou middleclick = nouvel onglet)
$('.line-click').live('click', function(e){
e.stopPropagation();
href = $(this).children('a:first').attr('href');
if (e.ctrlKey || e.metaKey || e.which == 2) {
window.open(href);
} else {
window.location = href;
}
You can’t perform that action at this time.