Skip to content

Instantly share code, notes, and snippets.

View lucasaba's full-sized avatar

Luca Saba lucasaba

View GitHub Profile
@lucasaba
lucasaba / PdfLoader
Created March 3, 2012 19:32
An implementation od Liip\ImagineBundle\Imagine\Data\Loader\LoaderInterface use to preview Pdfs
<?php
/**
* This is an implementation of the LoaderInterface from Liip\ImagineBundle
* wich can be found here: https://github.com/liip/LiipImagineBundle.
* This loader is used to add the ability to manage images from PDF.
* It requires the use of the convert and the identify programs from ImageMagick
* (http://www.imagemagick.org/).
* This class is also based on the work made on sfImageMagickAdapter by
* Fabien Potencier and Benjamin Meynell, but avoiding the exec
* has been suggested by Lukas Kahwe Smith.
@lucasaba
lucasaba / FileSystemLoader.php
Created March 3, 2012 20:55
Extending FileSystemLoader
namespace Hal\EpodBundle;
use Liip\ImagineBundle\Imagine\Data\Loader\FileSystemLoader;
class PdfLoader extends FileSystemLoader
{
/**
* Get the file info for the given path
*
@lucasaba
lucasaba / gist:5661223
Created May 28, 2013 08:05
Proposed change to SensioLabs\Connect\Buzz\Client\Curl
<?php
namespace SensioLabs\Connect\Buzz\Client;
use Buzz\Client\Curl as BaseCurl;
use Buzz\Message;
/**
* Curl
*
@lucasaba
lucasaba / gist:5747468
Created June 10, 2013 09:16
Ipotesi di script per il check della versione
<?php
chdir('./symfony-docs');
$dh = opendir(getcwd());
$files = shell_exec("find ./ -name \*.rst");
$out_string = "%-60s | %12s | %12s\n";
foreach(preg_split("/((\r?\n)|(\r\n?))/", trim($files)) as $file){
//Numero di revisione delt esto originale
$en_commit = shell_exec("git log -n 1 $file");
@lucasaba
lucasaba / translations_check.php
Last active February 6, 2018 18:55
This script checks the revision version between the original doc and its translation
<?php
chdir('./symfony-docs');
$red = "\033[0;31m";
$green = "\033[0;32m";
$yellow = "\033[0;33m";
$cyan = "\033[0;36m";
$files = shell_exec("find ./ -name \*.rst");
$out_string = "%-60s | %12s | %12s\n";
@lucasaba
lucasaba / vtiger_test_traduzioni.php
Created November 10, 2015 11:07
Controllo coerenza dei file originali e traduzione
#!/usr/bin/php
<?php
if(count($argv) != 3) {
echo "Utilizzo: vtiger_test_traduzioni.php <cartella traduzioni italiane> <cartella traduzioni originali>\n";
echo "Esempio: vtiger_test_traduzioni.php /home/utente/traduzioni/Vtiger-6.X-lingua-ITA/modules/ /var/www/vtiger/languages/en_us/\n";
return 0;
}
$folder_traduzioni = realpath($argv[1]);
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) Marco Trevisan
#
# Authors:
# Marco Trevisan <marco@trevisan.xyz>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 3.
@lucasaba
lucasaba / remote-upgrade
Created December 10, 2016 14:57
Gestisce l'aggiornamento dei server tramite ssh e apt
#!/bin/bash
show_help() {
cat << EOF
Usage: ${0##*/} [-hal] [SERVER]...
Invoca l'apt-get su uno o più server remoti.
-h mostra questa help ed esce
-a modifica il comando di apt-get in autoremove
-l effettua l'upgrade dei server virtuali interni
EOF
<?php
namespace Epod4\Moduli\ProtocolloBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
<?php
namespace Epod4\Moduli\ProtocolloBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
class ProtocolloExtension extends Extension
{
/**
* {@inheritDoc}