Skip to content

Instantly share code, notes, and snippets.

{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"title": "The Root Schema",
"required": [
"referenceType",
"referenceValue",
"dateOfBirth"
@foaly-nr1
foaly-nr1 / PacManCommand.php
Last active December 18, 2019 16:18
Pac Man style ProgressBar in Symfony command
<?php
namespace AppBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class PacManCommand extends ContainerAwareCommand
{
@foaly-nr1
foaly-nr1 / Event.php
Last active August 19, 2020 12:44
NotOverlapping Symfony date period validator
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use AppBundle\Validator\Constraints\NotOverlapping;
/**
* @NotOverlapping("period")
*/
@foaly-nr1
foaly-nr1 / clickable-element.html
Last active October 8, 2019 09:20 — forked from scottmagdalein/clickable-element.html
Make the Mailchimp Subscriber popup appear on click
<!-- This is the HTML element that, when clicked, will cause the popup to appear. -->
<button id="open-popup">Subscribe to our mailing list</button>
@foaly-nr1
foaly-nr1 / DateRangeType.php
Last active July 31, 2018 22:23 — forked from havvg/DateRange.php
Symfony2: poor man's date_range form type
<?php
namespace Ormigo\Bundle\OrmigoBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
<?php
namespace AppBundle\Form\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
class AddEntityChoiceSubscriber implements EventSubscriberInterface
@foaly-nr1
foaly-nr1 / bs3-modal-cmd.js
Created May 11, 2016 15:13
Prevents Bootstrap modal from being opened if cmd/ctrl key is pressed when triggering link is clicked
/**
* Prevents Bootstrap modal from being opened if cmd key is pressed when triggering link is clicked.
*/
(function BS3ModalCmd() {
'use strict';
// We listen during the capture phase to always be before bootstrap's event listeners. However,
// we can't detect whether the click is relevant for us, as a child element of the triggering
// element might have been clicked. We therefore just stop propagation for all clicks #hacky
document.addEventListener('click', (e) => {