Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Marc Morales Valldepérez mrcmorales

🏠
Working from home
  • Freelance
  • Amposta
View GitHub Profile
View virtualhost.conf
<VirtualHost *:80>
ServerName circuit.local
DocumentRoot /home/marc/work/circuit/web
<Directory /home/marc/work/circuit/web>
# enable the .htaccess rewrites
AllowOverride All
Require all granted
</Directory>
@mrcmorales
mrcmorales / TwigFunction.php
Last active Mar 24, 2016
Twig function example
View TwigFunction.php
<?php
namespace Circuit\AppBundle\Twig;
use Circuit\AppBundle\Entity\Category;
use Circuit\AppBundle\Entity\Competition;
use Circuit\AppBundle\Entity\CompetitionSeason;
use Circuit\AppBundle\Entity\Event;
use Circuit\AppBundle\Entity\Race;
use Circuit\AppBundle\Enum\GenderEnum;
View gist:ce97768a092f0980c518
<?php
namespace Circuit\AppBundle\CsvModel;
use Circuit\AppBundle\Entity\Inscription;
use EasyCSV\Writer;
/**
* Class UserExportCsvWriter.
*/
@mrcmorales
mrcmorales / gist:e3cd9f13828dea230036
Created Nov 15, 2014
Script test server hardware
View gist:e3cd9f13828dea230036
wget freevps.us/downloads/bench.sh -O - -o /dev/null|bash
View gist:dd49e9c83c7d5b2810b2
class WouzeeEventListener
{
protected $eventDispatcher;
public function __construct(EventDispatcherInterface $eventDispatcher)
{
$this->eventDispatcher = $eventDispatcher;
View getLink Request
@mrcmorales
mrcmorales / migrations table
Created Dec 28, 2013
add all migrations in new database
View migrations table
ls app/DoctrineMigrations | sed 's/[^0-9]*//g' | xargs -L 1 app/console doctrine:migrations:version --add
View UserRepository.php
public function findByPosition($latitude=40.46366700000001, $longitude=-3.7492200000000366, $distance=1500)
{
$config = $this->getEntityManager()->getConfiguration();
$config->addCustomNumericFunction('COS', 'DoctrineExtensions\Query\Mysql\Cos');
$config->addCustomNumericFunction('ACOS', 'DoctrineExtensions\Query\Mysql\Acos');
$config->addCustomNumericFunction('RADIANS', 'DoctrineExtensions\Query\Mysql\Radians');
$config->addCustomNumericFunction('SIN', 'DoctrineExtensions\Query\Mysql\Sin');
$qb = $this->createQueryBuilder('d')
->add('from','CliConsCoreBundle:User u')
View test.php
/** @var Ivory\GoogleMapBundle\Model\Map */
$map = $this->get('ivory_google_map.map');
$infoWindow = $this->get('ivory_google_map.info_window');
$marker = $this->get('ivory_google_map.marker');
$map->setMapOption('zoom', 4);
$map->setMapOption('mapTypeId', 'roadmap');
$map->setStylesheetOptions(array(
'width' => '100%',
View ConstructionFormType.php
<?php
namespace CliCons\ExtranetBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class ConstructionFormType extends AbstractType
{