Skip to content

Instantly share code, notes, and snippets.

View GeeH's full-sized avatar

Gary Hockin GeeH

View GitHub Profile
return array(
'environment' => function() {
$environment = (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production');
return $environment;
},
);
@GeeH
GeeH / f.php
Created September 18, 2012 09:28
validator array zf2
public function create($data = null) {
$json = "{ \"artist\":\"ergsern\", \"title\":\"enruy7u\" }";
$array = \Zend\Json\Decoder::decode($json);
$artist = new Input('artist');
$artist->getValidatorChain()->addValidator(new Validator\StringLength(array('min' => '5', 'max' => '20')));
$title = new Input('title');
$title->getValidatorChain()->addValidator(new Validator\StringLength(array('min' => '5', 'max' => '20')));
$inputFilter = new InputFilter();
@GeeH
GeeH / RFC-DHZM.md
Created October 18, 2012 08:33 — forked from Hounddog/RFC-DHZM.md
RFC - Decision Helper for ZF2 Modules

RFC Status: Work-in-Progress

@GeeH
GeeH / query.sql
Created February 21, 2013 11:13 — forked from Ocramius/query.sql
DELETE FROM
blah
WHERE
id NOT IN (
SELECT
c.id
FROM
blah c
LEFT JOIN
blah d
@GeeH
GeeH / FAFSServer.php
Created April 23, 2013 10:53
How the hell do you unit test this???
<?php
/**
* Gary Hockin
* 23/04/2013
*/
namespace FAFSServer\Service;
class FAFSServer
{
...
public function getServiceConfig()
{
return array(
'abstract_factories' => array(
'Application\\Factory\\ServiceFactory',
),
);
}
...

Keybase proof

I hereby claim:

  • I am Spabby on github.
  • I am GeeH (https://keybase.io/GeeH) on keybase.
  • I have a public key whose fingerprint is F376 F611 64B5 4950 F6C6 EF27 B811 9D4E 8B57 BF03

To claim this, I am signing this object:

<?php
/**
* Global Configuration Override
*
* You can use this file for overriding configuration values from modules, etc.
* You would place values in here that are agnostic to the environment and not
* sensitive to security.
*
* @NOTE: In practice, this file will typically be INCLUDED in your source
* control, so do not include passwords or other sensitive information in this
@GeeH
GeeH / IndexController.php
Created March 31, 2014 07:11
Logger functions not playing together??? ZF2 core functions.
<?php
namespace Application\Controller;
use Zend\Log\LoggerAwareInterface;
use Zend\Log\LoggerAwareTrait;
use Zend\Mvc\Controller\AbstractActionController;
// Logger Aware Interface applies initialiser that injects logger automagically
class IndexController extends AbstractActionController implements LoggerAwareInterface
<?php
// Clevertext db update script.
// Gary Hockin .. gary --at-- garyhockin --dot-- co --dot-- uk
// June 2006
// input stuff
// extract the GET values into variables
extract($_GET);
// connect to database