Skip to content

Instantly share code, notes, and snippets.

View ralphschindler's full-sized avatar

Ralph Schindler ralphschindler

View GitHub Profile
<?php
$service = 'Amazon';
chdir(__DIR__);
`git clone ./zf2 ZendService{$service}-library`;
`git clone ./zf2 ZendService{$service}-tests`;
chdir(__DIR__ . '/ZendService' . $service . '-library');
@ralphschindler
ralphschindler / conditional-ternary-eliminate-waste.php
Created March 4, 2011 15:59
Usage of the Conditional Ternary operator to reduce brace and newline waste when processing optional method parameters
<?php
class Coordinate
{
protected $x;
protected $y;
public function __construct($x = null, $y = null)
{
(empty($x)) ?: $this->setX($x);
@ralphschindler
ralphschindler / tree.php
Created April 21, 2010 14:42
'tree' console command, in PHP.
#!/usr/bin/php
<?php
/**
* Because you want "tree", but cannot find the source code quick enough
* on the web to compile for OS.X or there is no suitable implementation
* on windows.
*/
// set error reporting
error_reporting(E_STRICT | E_ALL);
<?php
setup();
$t = new Tree('top', 'T');
$t->append(new TreeNode('one', 1));
$t->append($x = new TreeNode('two', 2));
$t->append(new TreeNode('three', 3));
$t->append(new TreeNode('foo', 'foo'));