Skip to content

Instantly share code, notes, and snippets.

jnrbsn / better-gist-styles.css
Created September 14, 2010 01:24
Better styles for embedding GitHub Gists
/* Better styles for embedding GitHub Gists */
.gist pre{font-family:Menlo,Monaco,'Bitstream Vera Sans Mono','Courier New',monospace !important}
.gist-meta{font-family:Helvetica,Arial,sans-serif;font-size:13px !important}
.gist-meta a{color:#26a !important;text-decoration:none}
.gist-meta a:hover{color:#0e4071 !important}
igorw / gist:1050974
Created June 28, 2011 11:42
Controllers as services with Silex.
class LazyServiceController
private $container;
private $serviceName;
public function __construct(\Pimple $container, $serviceName)
$this->container = $container;
ziadoz /
Last active May 10, 2024 15:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
antillas21 / sites.php
Created April 16, 2012 21:23
Steps to take Drupal site out of multi-site install
$sites = array(
'' => '',
// the first in the file, refers to the url content in the browser's window,
//you may/probably should replace this with a FQDN.
// the second appearing after '=>' is the directory name inside sites/ where
//the site files are stored.
tPl0ch / FixtureTestCase.php
Created August 9, 2012 15:37
namespace Reizwerk\TestSuiteBundle\Test;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\Common\DataFixtures\Executor\MongoDBExecutor;
use Doctrine\Common\DataFixtures\Purger\MongoDBPurger;
use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
cgmartin / pre-commit
Last active October 9, 2015 06:17
ZF2 Git pre-commit hook
#!/usr/bin/env php
* .git/hooks/pre-commit
* This pre-commit hooks will check for PHP errors (lint), and make sure the
* code is PSR-2 compliant.
* Dependecy: PHP-CS-Fixer (
chx / gist:3958575
Created October 26, 2012 12:46
Making a Debian squeeze server into running Drupal 8 tests
apt-get update
aptitude install -y apache2 libonig2 libqdbm14 libxml2 apache2-mpm-prefork ucf libicu44 mysql-server libjpeg62 libpng12-0 libt1-5 libxpm4 git-core autoconf automake libssl-dev libtool shtool make
service mysql stop
sed -i 's/\/var\/lib\/mysql/\/dev\/shm\/mysql/g' /etc/mysql/my.cnf
sed -i '/en_US/a skip_innodb' /etc/mysql/my.cnf
service mysql start
echo ServerName localhost > /etc/apache2/httpd.conf
cd /etc/apache2/mods-enabled
ln -s ../mods-available/rewrite.load
davedevelopment / index.php
Created November 13, 2012 16:36
Tinkering with a Hal resource DTO, separating the framework from the app and content negotiation
namespace Demo {
require __DIR__."/vendor/autoload.php";
use Nocarrier\Hal;
class Resource extends Hal {}
class ResourceResponse
johnkary / ReadOnlyFieldSubscriber.php
Created November 30, 2012 16:09
Display read-only Phone Number field in browser, while disallowing editing via form, even if user modifies the DOM to remove the readonly attribute
namespace Acme\UserBundle\Listener;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
jonhattan /
Last active December 10, 2015 15:28
Example Drush commandfile. Place it in $HOME/.drush or /usr/share/drush/commands or any other valid location and clear drush cache afterwards.
function mycommands_drush_command() {
$items = array();
$items['one-command'] = array(
'description' => 'A command requiring two arguments.',
// Declare required arguments.
'arguments' => array(
'arg1' => 'arg1 description',
'arg2' => 'arg2 description',