Skip to content

Instantly share code, notes, and snippets.

View weaverryan's full-sized avatar

Ryan Weaver weaverryan

View GitHub Profile
@weaverryan
weaverryan / ideas.md
Last active December 20, 2023 14:32
Sharing Twig Components & Stimulus Controllers

Possible Components

  • Modal
  • Tooltip/Popover
  • Button
  • Tabs
  • Toast
  • Dropdown
  • Trix
  • (video player)
@weaverryan
weaverryan / ideas.md
Created December 9, 2023 14:35
Live Coding Ideas / Trying out Interesting / Hard stuff!
@weaverryan
weaverryan / FeatureContext.php
Created June 19, 2012 21:05
Behat Definition to help click generic links on different rows of a table
<?php
// ...
class FeatureContext extends MinkContext
{
/**
* Looks for a table, then looks for a row that contains the given text.
* Once it finds the right row, it clicks a link in that row.
*
@weaverryan
weaverryan / CheeseNormalizer.php
Created June 30, 2020 19:43
inlining children of a self-referencing to an IRI in API Platform
<?php
namespace App\Serializer\Normalizer;
use App\Entity\CheeseListing;
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
@weaverryan
weaverryan / Link.php
Created March 21, 2016 15:20
KnpUniversity Symfony REST: Using @link with the PaginatedCollection (http://knpuniversity.com/screencast/symfony-rest3/evaluating-expression)
@weaverryan
weaverryan / README.md
Last active April 28, 2020 14:07
Symfony Core Meeting Logs
Date Topics URL Summary
May 21st, 2015 core team organization, issue tagging/organization, PSR-7 logs --
June 4th, 2015 PSR-HttpFoundation, DI-PSR, issue triaging/organization, meeting organization logs --
June 18th, 2015 workflow/notifications, removing forums/ML, 3.0 changes - templating logs --
July 2nd, 2015 issues bot / HttpFoundation PSR-7 / dropping templating / new SE structure/ config component split / HttpKernel split logs summary
July 16th, 2015 issues bot / updates on initiatives / closing old issues logs --
July 30th, 2015 deprecatio
@weaverryan
weaverryan / ApiTestCase.php
Last active September 23, 2019 15:22
Example Symfony ApiTestCase (from WIP KnpUniversity Symfony REST tutorial)
<?php
namespace AppBundle\Tests\Controller\Api;
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
use Doctrine\ORM\EntityManager;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Message\ResponseInterface;
use GuzzleHttp\Subscriber\History;
@weaverryan
weaverryan / index.php
Created October 29, 2015 18:20
Potential Symfony MicroKernel example
<?php
require_once __DIR__.'/../vendor/autoload.php';
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\MicroKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
@weaverryan
weaverryan / Controller.php
Created April 21, 2015 17:22
Collecting Form Errors
<?php
// put this in your controller
protected function getErrorsFromForm(FormInterface $form)
{
$errors = array();
foreach ($form->getErrors() as $error) {
$errors[] = $error->getMessage();
}
@weaverryan
weaverryan / UniversityExtension.php
Last active July 9, 2018 16:16
Twig Extension with ContainerInterface injected
<?php
class UniversityExtension extends \Twig_Extension
{
private $container;
/**
* An internal cache used to prevent creating this chain loader multiple times
*/
private $twigChainLoader;