Skip to content

Instantly share code, notes, and snippets.

@joesexton00
joesexton00 / gist:08ffebe4dd667676f19223410201a7b6
Created July 11, 2016 14:40
Logical Or Validation Constraint
/**
* Constraint to validate any of the constraints added to it.
* At least one constraint must pass validation.
*
* @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*/
class LogicalOr extends Composite
{
public $message = 'This value is not valid.';
<?php
echo superDuperRandom($argv[1], $argv[2]);
function superDuperRandom($min, $max) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://ron-swanson-quotes.herokuapp.com/v2/quotes');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
@joesexton00
joesexton00 / PHP CLI Debugging
Last active January 21, 2016 15:44
CLI Debugging
# PHP CLI DEBUGGING
# `php-debug mysite.dev app/console cache:clear`
alias php-debug=phpdebug
function phpdebug {
CMD=`export PHP_IDE_CONFIG='serverName="echo $1"'`
eval $CMD
export XDEBUG_CONFIG="idekey=PHPSTORM"
shift
"$@"
unset XDEBUG_CONFIG
<?php
namespace Acme\Bundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;