Skip to content

Instantly share code, notes, and snippets.

View gargoyle's full-sized avatar
🏠
Working from home

Paul gargoyle

🏠
Working from home
View GitHub Profile
@gargoyle
gargoyle / phing_snippet.xml
Created October 24, 2016 12:14
Split out 3 section version number in Phing
<target name="loadVersion">
<loadfile property="version.full" file="VERSION.txt"/>
<php expression="count(explode('.','${version.full}',3))" returnProperty="version.segments"/>
<if>
<not><equals arg1="${version.segments}" arg2="3" /></not>
<then><fail message="Bad version number!"/></then>
</if>
<php expression="(int)explode('.','${version.full}',3)[0]" returnProperty="version.major"/>
<php expression="(int)explode('.','${version.full}',3)[1]" returnProperty="version.minor"/>
<php expression="(int)explode('.','${version.full}',3)[2]" returnProperty="version.rev"/>
➜ symfony git:(feature_zerofil_form_datetypes) ✗ phpunit DateTypeTest src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
PHPUnit 4.1.3 by Sebastian Bergmann.
Configuration read from /Volumes/Stuff/Code/Playground/symfony/phpunit.xml.dist
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
Time: 72 ms, Memory: 5.75Mb
OK, but incomplete, skipped, or risky tests!
Time: 4.04 minutes, Memory: 879.00Mb
There were 5 errors:
1) Symfony\Component\Locale\Tests\LocaleTest::testGetDisplayCountriesForSwitzerland
Symfony\Component\Intl\Exception\InvalidArgumentException: Only the locale "en" is supported.
/Volumes/Stuff/Code/Playground/symfony/src/Symfony/Component/Intl/ResourceBundle/Reader/PhpBundleReader.php:30
/Volumes/Stuff/Code/Playground/symfony/src/Symfony/Component/Intl/ResourceBundle/Reader/BufferedBundleReader.php:49
/Volumes/Stuff/Code/Playground/symfony/src/Symfony/Component/Intl/ResourceBundle/Reader/StructuredBundleReader.php:61
@gargoyle
gargoyle / gist:65c05eedf97de68da8cb
Last active August 29, 2015 14:02
/Users/paul/Applications/Test.app/Contents/MacOS/My Chrome
#!/usr/bin/env php
<?php
// Read prefs file
$prefsRaw = file_get_contents('/Users/ ** USERNAME ** /Library/Application Support/Google/Chrome/Default/Preferences');
$prefsJson = json_decode($prefsRaw);
// Rewrite (or create) "pinned_tabs" with fixed list of urls.
$myUrls = array(
<?php
/**
* Sets the stdout and stderr streams if they are not already set.
*/
private static function initializeOutputStreams() {
if (self::$out === null) {
if (!defined('STDOUT')) {
self::$out = new OutputStream(fopen('php://stdout', 'w'));
} else {
public function run()
{
$handler = new Place_handler();
$collection = $handler->getCollection();
$cursor = $handler->find();
$total = $cursor->count();
$count = 0;
foreach ($cursor as $doc) {
protected static function getConstantValues($prefix = '')
{
$refl = new ReflectionClass(get_called_class());
$allConstants = $refl->getConstants();
if ($prefix != '') {
$prefixLength = strlen($prefix);
$filteredList = array();
foreach ($allConstants as $key => $value) {
if (substr($key, 0, $prefixLength) == $prefix) {