Skip to content

Instantly share code, notes, and snippets.

View davedevelopment's full-sized avatar
😬
I may be slow to respond.

Dave Marshall davedevelopment

😬
I may be slow to respond.
View GitHub Profile
@davedevelopment
davedevelopment / Logging.php
Created August 5, 2011 22:25
Logging Trait
<?php
/**
* Logging trait
*
* @author Dave Marshall <[email protected]>
*/
trait Logging
{
@davedevelopment
davedevelopment / gist:1565175
Created January 5, 2012 13:04
Git bash prompt
# .bashrc
export GIT_PS1_SHOWDIRTYSTATE="true";
export GIT_PS1_SHOWSTASHSTATE="true";
export GIT_PS1_SHOWUNTRACKEDFILES="true";
export GIT_PS1_SHOWUPSTREAM="verbose"
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:$(__git_ps1 [%s])\[\033[01;34m\]\W\[\033[00m\]\$ '
{
"require": {
"php": ">=5.3.1",
"silex/silex": "*",
"symfony/console": "*",
"behat/behat": "*"
},
"config": {
"bin-dir": "bin/"
@davedevelopment
davedevelopment / FailingTest.php
Created February 29, 2012 12:20 — forked from dmitrybelyakov/FailingTest.php
Bootstrap phpunit
<?php
require_once ('PHPUnit/Autoload.php');
class FailingTest extends \PHPUnit_Framework_TestCase
{
public function testTestThatWeJustFail()
{
$this->assertTrue(true);
}
@davedevelopment
davedevelopment / AudioNotifier.php
Created March 1, 2012 13:46
Audio notifier for Sismo
<?php
use Sismo\Notifier;
use Sismo\Commit;
/**
* A simple audio notifier for Sismo
*
* (c) Dave Marshall <[email protected]>
*
<?php
require __DIR__.'/vendor/.composer/autoload.php';
$app = new Silex\Application();
$app->register(new Silex\Provider\SessionServiceProvider());
$app['debug'] = true;
$app->get('/', function() use($app) {
@davedevelopment
davedevelopment / index.php
Created March 27, 2012 22:12
Example of overriding service, without unnecessary loading
<?php
require_once __DIR__.'/vendor/.composer/autoload.php';
use Silex\Application;
$app = new Application;
$app['debug'] = true;
$app->register(new Silex\Provider\TwigServiceProvider(), array(
@davedevelopment
davedevelopment / index.php
Created March 28, 2012 08:11 — forked from igorw/index.php
Example of overriding service, without unnecessary loading
<?php
require_once __DIR__.'/vendor/.composer/autoload.php';
use Silex\Application;
$app = new Application;
$app['debug'] = true;
$app->register(new Silex\Provider\TwigServiceProvider(), array(
@davedevelopment
davedevelopment / generate_classmap.sh
Created March 29, 2012 15:56
Hacky way of populating composer classmap
#!/bin/bash
perl -pi -e 's/array\(/array\(___CLASSLIST___,\n/' vendor/.composer/autoload_classmap.php
phpab -n -t vendor/.composer/autoload_classmap.php -o vendor/.composer/autoload_classmap.php -b `pwd`/vendor/.composer/ --tolerant vendor/
perl -pi -e 's/array\(/array\(___CLASSLIST___,\n/' vendor/.composer/autoload_classmap.php
phpab -n -t vendor/.composer/autoload_classmap.php -o vendor/.composer/autoload_classmap.php -b `pwd`/vendor/.composer/ --tolerant src/
perl -pi -e "s/'\/\.\./\\\$vendorDir.'/" vendor/.composer/autoload_classmap.php
@davedevelopment
davedevelopment / gist:2884984
Created June 6, 2012 21:36
Print routes and where they're defined for a silex app
#!/usr/bin/env php
<?php
# bin/routes
$app = require __DIR__ . '/../app/bootstrap.php';
$routes = $app['routes']->all();
foreach($routes as $route) {
$cr = new ReflectionFunction($route->getDefault('_controller'));