Skip to content

Instantly share code, notes, and snippets.

View desarrolla2's full-sized avatar
💭
Team Manager and Developer | PHP | Symfony.

Daniel González desarrolla2

💭
Team Manager and Developer | PHP | Symfony.
View GitHub Profile
@desarrolla2
desarrolla2 / PrimeNumber.php
Last active December 16, 2015 14:09
PrimeNumber.php
<?php
/**
* This file is part of the planetubuntu proyect.
*
* Copyright (c)
* Daniel González <daniel.gonzalez@freelancemadrid.es>
*
* This source file is subject to the MIT license that is bundled
* with this package in the file LICENSE.
@desarrolla2
desarrolla2 / example1.php
Last active December 18, 2015 10:59
Charla Monolog
<?php
$record = 'OLA K ASE';
/**
* Log record
*
* @param string $record
*/
function log($record){
<?php
/**
* @param $form
* @return array
*/
private function getErrorsAsArray($form)
{
$errors = [];
foreach ($form->getErrors() as $error) {
@desarrolla2
desarrolla2 / gist:7216729
Created October 29, 2013 15:23
default.vcl
backend default {
.host = "127.0.0.1";
.port = "8080";
}
# vcl_recv (yes, we’re skimpy with characters, it’s Unix) is called at the beginning of a request, after the complete request has been received and parsed. Its purpose is to decide whether or not to serve the request, how to do it, and, if applicable, which backend to use.
# In vcl_recv you can also alter the request. Typically you can alter the cookies and add and remove request headers.
# Note that in vcl_recv only the request object, req is available.
@desarrolla2
desarrolla2 / DefaultController.php
Last active December 27, 2015 07:49
performance comparison mysql / doctrine vs ranbbit mq. The aim is to compare which is the performance difference between leaving a message on rabbit, or create a record in mysql. Doctrine and Rabbit are not the same technology, but we want to compare which is the performance difference, to know whether in a particular case, we should introduce r…
<?php
namespace Desarrolla2\Bundle\AnalyticsBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\JsonResponse;
use Desarrolla2\Bundle\AnalyticsBundle\Entity\Data;
<?php
namespace Mocks;
use Doctrine\DBAL\Driver\Statement;
/**
* Doctrine DBAL Statement implementing \Iterator.
*
* This class has been created because of a bug in PHPUnit Mock Objects.
server {
listen 8080;
server_name www.desarrolla2.com blog.desarrolla2.com;
rewrite ^(.*) http://desarrolla2.com$1 permanent;
}
server {
listen 8080;
<?php
use FastFeed\Factory;
$fastFeed = Factory::create();
$fastFeed->addFeed('default', 'http://desarrolla2.com/feed');
$items = $fastFeed->fetch('default');
<?php
/**
* This file is part of the lapera.local package.
*
* (c) Daniel González <daniel@desarrolla2.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace LaPera\RestBundle\Controller;
<?xml version="1.0" encoding="UTF-8" ?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"
xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping">
<entity name="Tadium\Component\Promotion\Model\Promotion"