Skip to content

Instantly share code, notes, and snippets.

View lyrixx's full-sized avatar
😀

Grégoire Pineau lyrixx

😀
View GitHub Profile
<?php
class baseDog
{
public $name;
}
class dog
{
protected $name;
@lyrixx
lyrixx / movieList.sh
Created June 4, 2011 17:15
Get a sorted list of your movies
#!/bin/bash
VIDEO_FOLDER=(
/PATH/TO/MOVIE1
/PATH/TO/MOVIE2
)
VIDEO_EXTENTION=(avi mkv mpg mpeg)
OUTPUT='movie_list.txt'
OUTPUT_TEMP=${OUTPUT}.temp
@lyrixx
lyrixx / gist:1087929
Created July 17, 2011 18:54
Twig String equals 0
Description
-----------
For twig, a string equals 0
Test script
-----------
{% set test = 'a string' %}
{% if test == 0 %}
test == 0
@lyrixx
lyrixx / base.twig
Created January 3, 2012 15:09 — forked from xavierbriand/base.twig
Twig training
{# manipulation des variables #}
{% set une_string = 'test' %}
<p>
{{ une_string }}
</p>
<hr />
@lyrixx
lyrixx / Project_Set_Node.php
Created January 3, 2012 16:23
Twig training 2
<?php
class Project_Set_Node extends Twig_Node
{
public function __construct($name, Twig_Node_Expression $value, $lineno)
{
parent::__construct(array('value' => $value), array('name' => $name), $lineno);
}
public function compile(Twig_Compiler $compiler)
{
@lyrixx
lyrixx / gist:1625927
Created January 17, 2012 09:46
PHP Upload file - upload_max_filesize
<html>
<?php
var_dump($_FILES);
if (isset($_FILES['test'])) {
$filetemp = $_FILES['test']['tmp_name']['file01'];
echo 'file tmp location : '.$filetemp.'<br />';
echo 'is file on disk ? : '.file_exists($filetemp).'<br />';
}
MODULES=(
plugins/ftAttractionPlugin
plugins/ftCalendarPlugin
plugins/ftCommonPlugin
plugins/ftContentPlugin
plugins/ftFormPlugin
plugins/ftHotelRestaurantPlugin
plugins/ftListingPlugin
plugins/ftMasterCatalogPlugin
plugins/ftNewsTipsPlugin
@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
@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 / 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, '');
}