Skip to content

Instantly share code, notes, and snippets.

View raphaelstolt's full-sized avatar
:octocat:
Focusing.

Raphael Stolt raphaelstolt

:octocat:
Focusing.
View GitHub Profile
@raphaelstolt
raphaelstolt / homebrew-php-to-phpbrew-migration.md
Last active April 16, 2018 20:38
Short guide on migrating from homebrew-php to phpbrew

#Migrating from homebrew-php to phpbrew

After installing phpbrew it's time to install a set of chosen PHP versions. My picks at the time of this writing were:

sudo phpbrew install php-5.5.0 +default+dbs+mb+apxs2=/usr/sbin/apxs
sudo phpbrew install php-5.4.17 +default+dbs+mb+apxs2=/usr/sbin/apxs
sudo phpbrew install php-5.3.27 +default+dbs+mb+apxs2=/usr/sbin/apxs

When not sure where apxs is located on your system, whereis apxs is quite chatty.

@raphaelstolt
raphaelstolt / php54_php53_pear_macports.markdown
Created May 17, 2012 21:37
Installing PHP 5.4 and 5.3 side by side on Max OSX via MacPorts

##Given Apache 2 and MySQL are already installed.

#Update MacPorts sudo port selfupdate;sudo port -u upgrade outdated

#Install PHP 5.4.* sudo port install php54 php54-apache2handler ##Activate Apache Module cd /opt/local/apache2/modules

@raphaelstolt
raphaelstolt / gist:2028006
Created March 13, 2012 10:20
Only apply JSONP(adding) via a Silex after filter on configured routes
$app->after(function (Request $request, Response $response) {
$appl = $request->attributes->get('app');
if ($request->get('jsonp_callback') !== null
&& $request->getMethod() === 'GET')
{
/**
* Configured via ConfigServiceProvider (https://github.com/igorw/ConfigServiceProvider)
* Example:
*
@raphaelstolt
raphaelstolt / pre-commit-phing
Created April 22, 2011 15:39
A Git pre-commit hook rejecting no-descriptive Phing and Ant build files
#!/usr/bin/php
<?php
define('DEPENDENT_EXTENSION', 'SimpleXML');
if (!extension_loaded(DEPENDENT_EXTENSION)) {
$consoleMessage = sprintf(
"Skipping build file checks as the '%s' extension isn't available.",
DEPENDENT_EXTENSION
);
echo $consoleMessage . PHP_EOL;
@raphaelstolt
raphaelstolt / BuildhawkLogger.php
Created November 20, 2010 14:42
A Phing logger providing data for the buildhawk gem
<?php
/*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
@raphaelstolt
raphaelstolt / pre-commit
Created September 20, 2010 21:35
A pre-commit for running PHPUnit
#!/usr/bin/php
<?php
printf("%sGit pre-commit hook %1\$s", PHP_EOL);
$projectName = basename(getcwd());
exec('phpunit --configuration phpunit.xml', $output, $returnCode); // Assuming cwd here
if ($returnCode !== 0) {
$minimalTestSummary = array_pop($output);
printf("Test suite for %s failed: ", $projectName);
printf("( %s ) %s%2\$s", $minimalTestSummary, PHP_EOL);
return false; // exit(1);
@raphaelstolt
raphaelstolt / redis-glue-test.php
Created May 15, 2010 04:45
Redis installation test script
<?php
define('TEST_KEY', 'are_we_glued');
$redis = new Redis();
try {
$redis->connect('localhost', 6379);
$redis->set(TEST_KEY, 'yes');
$glueStatus = $redis->get(TEST_KEY);
if ($glueStatus) {
$testKey = TEST_KEY;
echo "Glued with the Redis key value store:" . PHP_EOL;
@raphaelstolt
raphaelstolt / GitHubTicketListener.php
Created January 19, 2010 21:26
A PHPUnit ticket listener that interacts with the GitHub issue API
<?php
/**
* PHPUnit
*
* Copyright (c) 2002-2010, Sebastian Bergmann <sb@sebastian-bergmann.de>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@raphaelstolt
raphaelstolt / PHPUnit_Extension_TicketListener.diff
Created January 19, 2010 21:06
An 'exploratory' patch for the PHPUnit_Extension_TicketListener class
Index: TicketListener.php
===================================================================
--- TicketListener.php
+++ TicketListener.php
@@ -207,14 +207,16 @@ abstract class PHPUnit_Extensions_TicketListener implements PHPUnit_Framework_Te
} else {
$adjustTicket = TRUE;
}
+
+ $ticketInfo = $this->getTicketInfo($ticket);
@raphaelstolt
raphaelstolt / GrowlTestListener.php
Created November 23, 2009 19:21
A PHPUnit TestListener pushing the test results to Growl on Mac OS X
<?php
class PHPUnit_Extensions_TestListener_GrowlTestListener
implements PHPUnit_Framework_Testlistener
{
const TEST_RESULT_COLOR_RED = 'red';
const TEST_RESULT_COLOR_YELLOW = 'yellow';
const TEST_RESULT_COLOR_GREEN = 'green';
private $_errors = array();