Skip to content

Instantly share code, notes, and snippets.

View ezimuel's full-sized avatar
🇮🇹
Working remotely, since 2008

Enrico Zimuel ezimuel

🇮🇹
Working remotely, since 2008
View GitHub Profile
@ezimuel
ezimuel / gist:3129733
Created July 17, 2012 14:30
Script to convert all the ZF2 docs from DocBook to reStructuredText
<?php
require 'RstConvert.php';
$zf2Bin = '/path_to_zf2/bin';
$docbookPath = '/path_to_zf2/documentation/manual/en/module_specs';
foreach (glob("$docbookPath/*.xml") as $filename) {
$fileout = RstConvert::xmlFileNameToRst(basename($filename));
echo "Generating...$fileout\n";
ZF2 Documentation State of Art
------------------------------
Authentication (ok)
Barcode (ok)
Cache (to fix)
Captcha (ok)
Code (to be completed)
Config (ok)
Console (to be completed)
@ezimuel
ezimuel / gist:4566485
Created January 18, 2013 17:40
Usage of Zend\Crypt\Password\Apache
use Zend\Crypt\Password\Apache;
$apache = new Apache();
$apache->setFormat('crypt');
printf ("CRYPT output: %s\n", $apache->create('password'));
$apache->setFormat('sha1');
printf ("SHA1 output: %s\n", $apache->create('password'));
@ezimuel
ezimuel / gist:4707734
Created February 4, 2013 16:15
Strange error, PHPUnit is 3.7.13 but the error says PHPUnit 3.5.14
enrico@enrico-desktop:~/Lavoro/Git/zf2/tests$ phpunit Zend\Mvc
PHPUnit 3.7.13 by Sebastian Bergmann.
Cannot open file "ZendMvc.php".
enrico@enrico-desktop:~/Lavoro/Git/zf2/tests$ phpunit ZendTest/Mvc
PHPUNIT: 3.7.13
PHPUnit 3.7.13 by Sebastian Bergmann.
Configuration read from /home/enrico/Lavoro/Git/zf2/tests/phpunit.xml.dist
@ezimuel
ezimuel / gist:4996164
Created February 20, 2013 15:02
Strange composer installation for ZFTool
$ ./composer.phar install
Loading composer repositories with package information
Installing dependencies
- Installing zendframework/zend-version (2.1.1)
Loading from cache
- Installing zendframework/zendframework (2.1.1)
Loading from cache
zendframework/zendframework suggests installing doctrine/common (Doctrine\Common >=2.1 for annotation features)
@ezimuel
ezimuel / gist:5036694
Last active December 14, 2015 05:39
Proposal for Improvement of ZF2 RND
/**
* Generate random bytes using OpenSSL or Mcrypt and mt_rand() as fallback
*
* @param integer $length
* @param bool $strong true if you need a strong random generator (cryptography)
* @return string
* @throws Exception\RuntimeException
*/
public static function getBytes($length, $strong = false)
{
@ezimuel
ezimuel / gist:5091208
Created March 5, 2013 15:45
class_alias experiment
// rename the Zend\Stdlib\ArrayObject in Zend\Stdlib\ArrayObjectPHPFuture
// and copy he Zend\Stdlib\compatibility\ArrayObject in Zend\Stdlib\ArrayObjectPHPLegacy
if (version_compare(PHP_VERSION, '5.3.4', 'lt') {
class_alias('Zend\Stdlib\ArrayObjectPHPLegacy', 'ArrayObject');
} else {
class_alias('Zend\Stdlib\ArrayObjectPHPFuture', 'ArrayObject');
}
$test = new ArrayObject();
@ezimuel
ezimuel / gist:5135662
Created March 11, 2013 16:55
DB2 configuration file connect using ZF2 and ODBC using config/autoload/local.php
<?php
$database = '';
$hostname = '';
$port = '';
$user = '';
$password = '';
return array(
'db' => array(
@ezimuel
ezimuel / gist:5301941
Created April 3, 2013 14:58
Db2 connect using ODBC parameters
<?php
$database = '';
$user = '';
$password = '';
$hostname = '';
$port = 446;
$conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;".
"HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;";
/GET /user
OK Response (200):
{
"user" : {
"name" : "Foo",
"email" : "foo@bar.com"
}
}