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 / CachedRepository.php
Created January 29, 2013 15:48
Cached repository
<?php
namespace Tvision\Bundle\BookingCoreBundle\Repository;
/**
*
* usage
* Class MyRepository extends CachedRepository
* $query->setMaxResults(1);
* $this->setCache($query, __METHOD__);
@liuggio
liuggio / speakmes.sh
Created February 14, 2013 17:56
after long bash processing this speak the message
function speakmsg {
MESSAGE="OK";
ERROR_="Fail";
LANG="english";
if [ $1 -ne 0 ]; then MESSAGE=$ERROR;fi;
echo $MESSAGE |espeak -p 10 -s 70 -v $LANG;
}
#usage
phpunit; #or your favourite long command
<?php
$factory = new FactoryObject();
$this->changeSetEventManager = new EventManager();
$this->changeSet = new ChangeSet($this->changeSetEventManager);
$extractor = new IdentityExtractorFactory();
$extractor->add('Spicci\Github\Entity\Milestone', '\Spicci\Github\IdIdentityExtractor');
$this->identityMap = new IdentityMap($extractor);
@liuggio
liuggio / All Your Pull request.md
Last active September 14, 2020 10:05
Your Pull Request timeline

In order to obtain all your Open source Pull-Request history:

  1. Go to Google bigquery and execute the following query replacing liuggio with your GitHub login

  2. execute query

SELECT repository_url, repository_owner, repository_name, count(*) as numberOfPR
FROM [githubarchive:github.timeline]
WHERE payload_pull_request_head_repo_owner_login = "liuggio"
@liuggio
liuggio / generator.php
Last active December 24, 2015 08:29
problem with generator during eval
<?php
// with $this->serializer = $this->getMock('Symfony\Component\Serializer\SerializerInterface');
// the $code content into the eval($code) into phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Generator.php
class Mock_SerializerInterface_ec3da84e implements PHPUnit_Framework_MockObject_MockObject, JMS\Serializer\SerializerInterface
{
private static $__phpunit_staticInvocationMocker;
private $__phpunit_invocationMocker;
public function __clone()
{
@liuggio
liuggio / .gitignore_global
Last active December 26, 2015 07:19
git init
.idea
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
@liuggio
liuggio / SwapKeys.md
Last active December 26, 2015 12:29
SwapKeys joke

Swap Keys the funny joke

we are a great team @gianpiero2012 @toretto460 @danieledangeli @claudio-dalicandro

The game consists of inverting 2 keyboard keys both physically and in terms of key-map of your team mate.

It doesn't require root access.

Install

@liuggio
liuggio / largestfiles.sh
Created November 26, 2013 13:59
largest files and directories
FS='/';NUMRESULTS=20;resize;clear;date;df -h $FS; echo "Largest Directories:"; du -x $FS 2>/dev/null| sort -rnk1| head -n $NUMRESULTS| awk '{printf "%d MB %s\n", $1/1024,$2}';echo "Largest Files:"; nice -n 19 find $FS -mount -type f -ls 2>/dev/null| sort -rnk7| head -n $NUMRESULTS|awk '{printf "%d MB\t%s\n",($7/1024)/1024,$NF}'
@liuggio
liuggio / MyWarmer.php
Last active August 29, 2015 13:56
caches
<?php
namespace Acme\Foo;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
class FooCacheWarmer implements CacheWarmerInterface
{
public function isOptional()
{
liuggio = new Employee();
liuggio.createdAt = new Datetime("now")
liuggio.salaryPrice = 9999999.00
liuggio.salaryCurrency = "EUR"
liuggio.name = "liuggio"
if not externalValidator.validate(liuggio, context) {
return error
}