This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "andrewkirkpatrick/sample", | |
"description": "Sample project", | |
"homepage": "http://www.andrew-kirkpatrick.co.uk", | |
"repositories": [{ | |
"type": "package", | |
"package": { | |
"name": "andrewkirkpatrick/library", | |
"version": "dev-master", | |
"source": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Mock JSON | |
$json = <<< JSON | |
{ | |
"timestamp": 1385150462, | |
"stuff": { | |
"this": 2, | |
"that": 4, | |
"other": 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Module | |
{ | |
public function onBootstrap(MvcEvent $e) | |
{ | |
/* | |
* Other module code as usual... | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NameVirtualHost *:80 | |
<VirtualHost *:80> | |
VirtualDocumentRoot "/usr/local/zend/apache2/htdocs/%1/public" | |
<Directory "/usr/local/zend/apache2/htdocs/%1/public"> | |
Allow From All | |
</Directory> | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($argc <= 1) | |
exit("No score was passed\n"); | |
$inputScore = (integer) $argv[1]; | |
$x = 0; | |
$validScores = array($x); | |
print "Input score: $inputScore\n"; | |
while ($x <= $inputScore) { // Do until last valid score is higher than input score | |
$array = $validScores; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Output the URL in the view | |
echo $this->url('somewhere', | |
array('controller' => 'company', | |
'action'=>'edit', | |
'id' => $company->id | |
) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Output the URL in the view | |
echo $this->url('somewhere', | |
array('controller' => 'company', | |
'action'=>'edit' | |
), | |
array('query' => | |
array('id' => $company->id) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return array( | |
'router' => array( | |
'routes' => array( | |
'somewhere' => array( | |
'type' => 'segment', | |
'options' => array( | |
'route' => '/company/edit/[/:id]', | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$model = "Big ultra super car with mega turbo charger"; | |
$limit = 10; | |
$words = explode(' ', $model); | |
$sentence = ''; | |
foreach ($words as $word) { | |
$sentence .= $word . ' '; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Delete the contents of a directory (recursively by default) | |
* @todo Handle recursion when calls return false | |
* @param string $path Path to the directory | |
* @param boolean $recursive Whether to delete recursively (true by default) | |
* @return boolean Success or failure | |
*/ | |
function deleteDirectoryContents($path, $recursive = true) |