Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
The next step…

Michelangelo van Dam DragonBe

:octocat:
The next step…
View GitHub Profile
@DragonBe
DragonBe / Autoload_ZF1_apps_in_Apigility.md
Last active Aug 29, 2015
Procedure to autoload ZF1 applications in Apigility
View Autoload_ZF1_apps_in_Apigility.md

Autoloading ZF1 apps in Apigility

This is a procedure I write to autoload a ZF1 project into a ZF2 based application, using Apigility as an example.

Requirements

  • PHP 5.4 or higher
  • A ZF1 project, I'm using my demo application zfdemo as example
  • Composer
  • An IDE
View keybase.md

Keybase proof

I hereby claim:

  • I am dragonbe on github.
  • I am dragonbe (https://keybase.io/dragonbe) on keybase.
  • I have a public key whose fingerprint is 2FAD DAA1 D05E 185E 54BF 49A1 85BF 2A2B CDE4 64C3

To claim this, I am signing this object:

@DragonBe
DragonBe / check404.sh
Created Jul 1, 2014
Quickly scan your Apache logs for 404 replies. Usage /bin/sh ./check404.sh /path/to/apache_log
View check404.sh
#!/bin/sh
awk '$9 == 404 {print $7}' ${1} | uniq -c | sort -rn | head
@DragonBe
DragonBe / ZendMailTest.php
Created Jul 17, 2014
Testing if mail headers are properly removed
View ZendMailTest.php
<?php
namespace BMytest;
class ZendMailTest extends \PHPUnit_Framework_TestCase
{
public function testRemovingHeadersFromMultipleMailObjects()
{
$mail1 = new \Zend_Mail();
$mail1->addHeader('foo', 'bar');
$mail1->addHeader('x-mfo-mailid', uniqid());
@DragonBe
DragonBe / GeehNiblett_Module.php
Last active Aug 29, 2015
GeehNiblett to override view templates in ZfCUser
View GeehNiblett_Module.php
<?php
namespace GeehNiblett;
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;
class Module implements AutoloaderProviderInterface, ConfigProviderInterface
{
public function init($moduleManager)
{
View phpsyntax-highlighter.php
<?php
ini_set('highlight.comment', '#cc8800');
ini_set('highlight.default', '#6699cc');
ini_set('highlight.html','#000000');
ini_set('highlight.keyword', '#993333');
ini_set('highlight.string', '#66cc66');
$code = '';
if (isset ($_POST['code'])) {
$code = $_POST['code'];
@DragonBe
DragonBe / phonenumberfilter
Created Mar 15, 2012
Simple filtering of phone numbers
View phonenumberfilter
````php
<?php
$phoneNumber = '(202) 555-2041';
$filterPhone = preg_repace('/[^0-9]+/','', $phoneNumber);
````
@DragonBe
DragonBe / phpunit.xml
Created Oct 8, 2012
Setting up a clean phpunit configuration for Zend Framework 2
View phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="bootstrap.php" colors="true">
<testsuites>
<testsuite name="zf2demo">
<directory>./</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
@DragonBe
DragonBe / install.stout
Created Oct 8, 2012
Output of composer installation of ZF2
View install.stout
phpbook:zf2demo dragonbe$ php composer.phar install --dev
Loading composer repositories with package information
Installing dependencies
- Installing zendframework/zendframework (2.0.2)
Downloading: 100%
Loading composer repositories with package information
Installing dev dependencies
Nothing to install or update
zendframework/zendframework suggests installing doctrine/common (Doctrine\Common >=2.1 for annotation features)
@DragonBe
DragonBe / listCDNEndpoints.php
Created Nov 6, 2012
My trial to access CDN API of Windows Azure
View listCDNEndpoints.php
public function listCdnEndpoints()
{
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getCdnEndpointsPath());
$context->addStatusCode(Resources::STATUS_OK);
// echo '<pre>' . var_export($context,1) . '</pre>';die;
$response = $this->sendContext($context);
You can’t perform that action at this time.