Skip to content

Instantly share code, notes, and snippets.

View liuggio's full-sized avatar

Giulio De Donato liuggio

  • Radical Company
  • London
View GitHub Profile
@liuggio
liuggio / doctrine-centrilized-query.md
Created July 9, 2012 10:49
doctrine Centralized query RFC

Now:

 $query = $this->getEntityManager()
            ->createQuery(
            'SELECT s FROM AcmeDemoBundle:Service s
             WHERE  s.status = :serviceStatus
            ');
        $query->setParameter('serviceStatus', Service::STATUS_ENABLED);
@liuggio
liuggio / phpunit-log-junit.php
Created May 26, 2012 12:16 — forked from elazar/phpunit-log-junit.php
PHPUnit --log-junit processor
<?php
/**
* This script is used to process the output of a PHPUnit test run
* that uses --log-junit for the purposes of timing each executed
* test method. It outputs test methods with their respective
* runtimes in order from largest to smallest. Times are in
* seconds. The script accepts paths to any number of files in the
* JUnit log format.
*
* Ex: php phpunit-log-junit.php /path/to/junit-log1.xml /path/to/junit-log2.xml ...
@liuggio
liuggio / bulkRename.sh
Created May 24, 2012 14:57
Bulk recursive rename dirs and files
#!/bin/bash
# $1 is the var
# $2 is replace from
# $3 is replace to
EXPECTED_ARGS=3
E_BADARGS=65
HELP=$(cat <<EOF
Usage with three arguments:
`basename $0` /var/www/path/ typo type
@liuggio
liuggio / UsingGitHubAsAssetsCloudFiles-.git-hooks-post-commit
Created April 20, 2012 08:11
symfony2 store your assets into the github
#!/bin/sh
# in you /UsingGitHubAsAssetsCloudFiles/.git/hooks/post-commit
git push origin master
@liuggio
liuggio / app-config-config.yml
Created April 19, 2012 12:53
Symfony2 assets on RackSpace Cloud files [config.yml, parameter.ini]
framework:
# ...
templating:
# ...
packages:
## if you want to redirect just some asset remember to add also into twig file the package='rscf'
rscf:
base_urls: [%rackspace_container_url%]
## or use the generic:
# assets_base_urls:
@liuggio
liuggio / Yahoo Search Marketing.js
Created March 2, 2012 15:18
Yahoo! Search Marketing
<SCRIPT language="JavaScript" type="text/javascript">
<!-- Yahoo! Search Marketing
window.ysm_customData = new Object();
window.ysm_customData.conversion = "transId=1,currency=2,amount
=3";
var ysm_accountid = "1TGFOC61CVR7IG61MK9SVDEMIDG";
document.write("<SCR" + "IPT language='JavaScript' type='text/
javascript' "
+ "SRC=//" + "qasrv1.wa.marketingsolutions.yahoo.com" +
"/script/ScriptServlet" + "?aid=" + ysm_accountid
@liuggio
liuggio / PartnerManager.php
Created February 10, 2012 14:26
phpunit-closure best practice
/**
* insert a new row into the Entity trackVisit
*
* @param int $affiliateCampainId
* @param string $ipAddress
*/
public function trackVisit($affiliateCampainId, $ipAddress)
{
$visit = new trackVisit();
$visit->setIdentifier($affiliateCampainId);