Skip to content

Instantly share code, notes, and snippets.

View lyrixx's full-sized avatar
😀

Grégoire Pineau lyrixx

😀
View GitHub Profile
@lyrixx
lyrixx / .gitignore
Last active December 15, 2015 08:18
Rapt crawler.
/composer.lock
/vendor/
@lyrixx
lyrixx / code.php
Created December 27, 2012 10:56
Form debug
<?php
Forms::createFormFactory()->createBuilder();
// see https://github.com/sensiolabs/connect/blob/master/tests/SensioLabs/Connect/Bridge/Symfony/Form/ErrorTranslatorTest.php#L18
// With form on master (commit 0277f1a9c3bec27083c8aa79837c26b6f81b1ae8)
@lyrixx
lyrixx / getGlobalVarInWindow.js
Created December 14, 2012 19:59
get all global vars stored in window
(function(k,l,r,m,i,e,c,o,g){
for(i in window) k.push(i)
e = document.createElement("iframe")
e.style.display = "none"
document.body.appendChild(e)
c = e.contentWindow
for(o in c) l.push(o)
for(g=k.length;m < g;m++) if(!~l.indexOf(k[m])) r.push(k[m])
return r
})([],[],[],0)
@lyrixx
lyrixx / fab-doc.py
Created November 12, 2012 21:44
fab-doc
from fabric.api import local, abort, lcd, settings
from fabric.colors import red, green
from fabric.decorators import task
import os
@task
def post_commit(sha1=None, push=False):
"""
Call this task after a commit.
Sample of post-commit hook:
@lyrixx
lyrixx / deploy.php
Created September 25, 2012 16:20
depoy via zip
<?php
/* Define your constante here */
define('DESTINATION_BASE', '/home/sensio/dev/danone_prod/');
define('DESTINATION_FOLDER_BASENAME', 'DANONEPRO_PHP_%s');
define('DESTINATION_FOLDER_DOC_BASENAME', 'DANONEPRO_PHP_DOC_%s');
/* Do not touch after */
@lyrixx
lyrixx / git2svn_tag.sh
Created September 25, 2012 14:28
Git 2 svn : create tag
#!/bin/bash
# set -x
for t in `git tag` ; do git tag -d $t > /dev/null ; done
for branch in `git -c "color.ui"=false branch -r`; do
if echo "$branch" | \grep -v "^tag" 2>&1 >/dev/null ; then
continue
fi
@lyrixx
lyrixx / getRandomString.php
Created August 7, 2012 16:45
Generate a random string
<?php
$list = array_merge(range('a', 'z'), range('A', 'Z'), range(0, 9));
function getRandomString($length, $list) {
$str = array_fill(0, $length, null);
$str = array_map(function($item) use ($list) { return $list[array_rand($list)]; }, $str);
return join($str, '');
}
@lyrixx
lyrixx / Symfony-finder-bench.txt
Created August 1, 2012 22:24
Symfony-finder-bench.txt
Starting benchmark, it takes several minutes...
1010 files
110 directories
10 iterations
18 cases
2 adapters
@lyrixx
lyrixx / fab.py
Created May 29, 2012 12:11
Fabfile, promp with a list
i = 0
for dump in dumps:
print cyan('%(i)s => %(dump)s' % {'i':i, 'dump':dump})
i += 1
def validateDumpNumber(arg):
if i < int(arg):
raise Exception('You have to choose an int among [0-%(i)s], not %(arg)s' % {'i':i, 'arg':arg})
return arg
MODULES=(
plugins/ftAttractionPlugin
plugins/ftCalendarPlugin
plugins/ftCommonPlugin
plugins/ftContentPlugin
plugins/ftFormPlugin
plugins/ftHotelRestaurantPlugin
plugins/ftListingPlugin
plugins/ftMasterCatalogPlugin
plugins/ftNewsTipsPlugin