Skip to content

Instantly share code, notes, and snippets.

View ludofleury's full-sized avatar
🐼
Yay

Ludovic Fleury ludofleury

🐼
Yay
View GitHub Profile
@ludofleury
ludofleury / gist:828193
Created February 15, 2011 20:36 — forked from tyx/gist:816180
// 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;
}
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.
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")
}
/**
* Description
*
* @param hey
*
* @return pwet
*
* @Mongo/Hey
* @Assert/Url()
*/
@ludofleury
ludofleury / gist:3379524
Created August 17, 2012 14:57 — forked from clintongormley/gist:1088986
Create index for partial matching of names in ElasticSearch
# 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 February 22, 2012 17:04 — forked from naholyr/compare.php
Extract namespace from a PHP file
<?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];