Skip to content

Instantly share code, notes, and snippets.

@jakzal
jakzal / application_pings_the_server.feature
Last active August 29, 2015 13:57
Application pings the server
@wip
Feature: Application pings the server
In order to debug the server's health
I need to ping the server
As an Application
Scenario: Debugging request content and headers
When the client requests POST "/debug" with:
"""
X-Debug: 1
@jakzal
jakzal / HttpFacade.php
Last active August 29, 2015 14:00
Controller as a listener
<?php
use Symfony\Component\HttpFoundation\RequestStack;
class HttpFacade
{
/**
* @var RequestStack
*/
private $requestStack;
@jakzal
jakzal / php.lang
Created May 30, 2014 20:14
Highlight themes
Description="PHP"
Keywords={
{ Id=1,
List={"abstract", "and", "array", "as", "break", "case", "catch", "cfunction", "class", "clone", "const",
"continue", "declare", "default", "do", "else", "elseif", "enddeclare", "endfor", "endforeach", "endif",
"endswitch", "endwhile", "extends", "final", "for", "foreach", "function", "global", "goto", "if", "implements",
"interface", "instanceof", "namespace", "new", "old_function", "or", "private", "protected", "public", "static",
"switch", "throw", "try", "use", "var", "while", "xor", "__CLASS__", "__DIR__", "__FILE__", "__FUNCTION__",
@jakzal
jakzal / PhpServerContext.php
Last active August 29, 2015 14:02
PHP Server Behat Context
<?php
use Behat\Behat\Context\Context;
use Symfony\Component\Process\Process;
class PhpServerContext implements Context
{
/**
* @var Process
*/
@jakzal
jakzal / BehatRunnerContext.php
Created June 9, 2014 19:33
Behat runner context
<?php
use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\PyStringNode;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
class BehatRunnerContext implements Context
{
@jakzal
jakzal / dump.php
Last active August 29, 2015 14:04
Dump a Symfony Standard Edition DI container
<?php
/**
* @license MIT
*/
$loader = require_once __DIR__.'/bootstrap.php.cache';
require_once __DIR__.'/AppKernel.php';
use Symfony\Component\Config\ConfigCache;
@jakzal
jakzal / composer.json
Created February 4, 2015 15:43
form.php
{
"require": {
"symfony/form": "2.6.2",
"symfony/http-foundation": "2.6.2",
"symfony/twig-bridge": "2.3.*"
}
}
@jakzal
jakzal / Dockerfile
Created March 5, 2015 11:29
Symfony in Docker
# tools/docker/Dockerfile
FROM php:5.6-cli
VOLUME /symfony
WORKDIR /symfony
ENV COMPOSER_HOME=/usr/local/composer
ENV PATH /usr/local/composer/vendor/bin:$PATH
COPY php.ini /usr/local/etc/php/php.ini
@jakzal
jakzal / find-unused.sh
Created April 2, 2015 13:37
Find unused methods in a PHP code base
#!/bin/bash
ag 'function.*\(' | \
sed -e 's/.*function \([^(]*\)(.*/\1/g' | \
sort -u | \
xargs -I% bash -c "[ `ag '%\(' | wc -l` == 1 ] && echo %"
@jakzal
jakzal / gist:675734
Created November 13, 2010 23:17
Ubuntu init script for sasc-ng
We couldn’t find that file to show.