Skip to content

Instantly share code, notes, and snippets.

View yceruto's full-sized avatar
🥸
Solving object-oriented problems!

Yonel Ceruto yceruto

🥸
Solving object-oriented problems!
View GitHub Profile
@yceruto
yceruto / OAuth2GuardToken.php
Created November 1, 2020 17:21
Guard Authenticator for OAuth2Bundle (https://github.com/trikoder/oauth2-bundle)
<?php
namespace App\Security\Authentication\Token;
use Symfony\Component\Security\Guard\Token\GuardTokenInterface;
use Trikoder\Bundle\OAuth2Bundle\Security\Authentication\Token\OAuth2Token;
class OAuth2GuardToken implements GuardTokenInterface
{
private $token;
@yceruto
yceruto / EasyAdminDTOController.php
Last active May 17, 2019 13:14
DTO simplification for EasyAdminBundle applications
<?php
namespace App\Controller;
use EasyCorp\Bundle\EasyAdminBundle\Controller\EasyAdminController;
use Symfony\Component\Form\FormInterface;
/**
* See more https://github.com/yceruto/easyadmin-demo/tree/dto_example
*/
@yceruto
yceruto / FilesystemCacheWarmer.php
Last active September 26, 2022 08:46
Twig filesystem cache warmer
<?php
use Symfony\Component\Finder\Finder;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
class FilesystemCacheWarmer
{
private $twig;
@yceruto
yceruto / install.sh
Created January 16, 2018 21:51 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
@yceruto
yceruto / CustomGroupsExclusionStrategy
Created November 23, 2016 16:09
Custom groups exclusion strategy with strict option
<?php
namespace AppBundle\Serializer\Exclusion;
use JMS\Serializer\Context;
use JMS\Serializer\Exclusion\GroupsExclusionStrategy;
use JMS\Serializer\Metadata\PropertyMetadata;
class CustomGroupsExclusionStrategy extends GroupsExclusionStrategy
{
<?php
namespace AppBundle\Form\Extension;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;