Skip to content

Instantly share code, notes, and snippets.

View padraic's full-sized avatar
💭
Contact me by email. I am temporarily inactive on Github.

Pádraic Brady padraic

💭
Contact me by email. I am temporarily inactive on Github.
View GitHub Profile
<?php
$preloads = array(
// from get_declared_classes()
'Zend_Controller_Front',
'Zend_Controller_Plugin_Abstract',
'Zend_Controller_Plugin_Broker',
'Zend_Controller_Router_Abstract',
'Zend_Controller_Router_Rewrite',
'Zend_Controller_Router_Route_Abstract',
'Zend_Controller_Router_Route',
remote: Counting objects: 1032, done.
remote: Compressing objects: 100% (320/320), done.
remote: Total 836 (delta 508), reused 691 (delta 416)
Receiving objects: 100% (836/836), 322.07 KiB | 56 KiB/s, done.
Resolving deltas: 100% (508/508), completed with 120 local objects.
From git://git.zendframework.com/zf
* branch master -> FETCH_HEAD
CONFLICT (rename/add): Rename library/Zend/Feed/PubSubHubbub/Model/ModelAbstract.php->library/Zend/Markup/Renderer/Markup/Replace.php in ccb08e825849762b96d0c6db327d2fc159384d68. library/Zend/Markup/Renderer/Markup/Replace.php added in HEAD
Adding as library/Zend/Markup/Renderer/Markup/Replace.php~HEAD instead
CONFLICT (rename/rename): Rename "library/Zend/Markup/Renderer/HTML/Code.php"->"library/Zend/Markup/Renderer/Markup/Replace.php" in branch "HEAD" rename "library/Zend/Markup/Renderer/HTML/Code.php"->"library/Zend/Markup/Renderer/Markup/HTML/Code.php" in "ccb08e825849762b96d0c6db327d2fc159384d68"
PASS #1 - SMALL FILE
=============================================
HTMLPurifier Pass #1 - Small File:
----------------------------------------------------
marker time index ex time perct
----------------------------------------------------
Start 1278617711.57713300 - 0.00%
----------------------------------------------------
Stop 1278617715.11053700 3.533404 100.00%
@padraic
padraic / test-double-counter.php
Created April 8, 2011 18:57
Simple script which attempts to count the hard coded Test Doubles used by a PHPUnit test suite.
<?php
/**
* Purpose of the exercise is to analyse test case files. Any classes defined
* therein in addition to the actual test case class is assumed to be a
* hard coded Test Double. Now, where's my pinch of salt...
*
* Script's sole argument is the path (to a test directory) to analyse.
*/
<?php
class MockeryTest_InterMethod1
{
public function doFirst() {
return $this->doSecond();
}
private function doSecond() {
return $this->doThird();
public function testMockedMethodsCallableFromWithinOriginalClass()
{
$mock = $this->container->mock('MockeryTest_InterMethod1[doThird]');
$mock->shouldReceive('doThird')->andReturn(true);
$this->assertTrue($mock->doFirst());
}
@padraic
padraic / .package.php
Created April 13, 2011 18:52
Package spec as a PHP 5.3 closure?
<?php
$package = function ($s) {
$s->name = 'Overlord';
$s->authors = 'Padraic Brady, Sauron[sauron@mordor.me]';
$s->version = '0.0.1-dev';
$s->api_version = '0.0.1-dev';
$s->summary = 'Monitoring library for Hobbit Detector 1.0';
$s->description = file_get_contents(__DIR__ . '/description.txt');
$s->homepage = 'http://en.wikipedia.org/wiki/Sauron';
The following tasks need to be done to finish the i18n component:
------------------------------------------------------------------------------
To finish translator:
- Add Xliff translation loader with plural support if possible, see:
https://wiki.oasis-open.org/xliff/XLIFF2.0/Feature/Plural%20Entries
- Add Tmx translation loader (identify if plural support is available)
- Complete unit tests
------------------------------------------------------------------------------
@padraic
padraic / escaping-rfc.md
Created July 7, 2012 14:27
Escaping RFC for PHP Core - Basically Zend\Escaper in C

* Version: 1.0

* Date: 2012-09-18

* Author: Pádraic <padraic.brady.at.gmail.com>

* Status: Under Discussion

* First Published at: http://wiki.php.net/rfc/escaper

@padraic
padraic / xeedefense.php
Created August 14, 2012 18:25
xee defense
<?php
$dom = new DOMDocument;
$dom->loadXML($xml);
foreach ($dom->childNodes as $child) {
if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) {
throw new \InvalidArgumentException(
'Invalid XML: Detected use of illegal DOCTYPE'
);
}