Skip to content

Instantly share code, notes, and snippets.

Working on a transition plan

Matthew Weier O'Phinney weierophinney

Working on a transition plan
Block or report user

Report or block weierophinney

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@weierophinney
weierophinney / Module.php
Created Feb 5, 2014
Example of attaching to the "authenticate" event.
View Module.php
<?php
class Module
{
public function onBootstrap($e)
{
$app = $e->getApplication();
$services = $app->getServiceManager();
$events = $app->getEventManager();
$events->attach('authenticate', function ($e) use ($services) {
@weierophinney
weierophinney / rtut.zsh
Created Feb 11, 2014
PHPUnit test runner using inotifywait
View rtut.zsh
#!/bin/zsh
#
# Copyright (c) 2014, Joshua Thijssen
# Copyright (c) 2014, Matthew Weier O'Phinney
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
View keybase.md

Keybase proof

I hereby claim:

  • I am weierophinney on github.
  • I am mwop (https://keybase.io/mwop) on keybase.
  • I have a public key whose fingerprint is 8D98 47CD E15F 050B 8197 6BA7 B545 7969 23ED 29DA

To claim this, I am signing this object:

@weierophinney
weierophinney / composer.json
Created Apr 23, 2014
Adding apigility deps to an existing repo
View composer.json
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
@weierophinney
weierophinney / Module.php
Created May 7, 2014
Returning early if a specific HTTP header is missing
View Module.php
<?php
namespace SomeApi;
use ZF\ApiProblem\ApiProblem;
use ZF\ApiProblem\ApiProblemResponse;
class Module
{
public function onBootstrap($e)
{
@weierophinney
weierophinney / TableGatewayFeaturesDelegatorFactory.php
Last active Aug 29, 2015
delegator for injecting TableGateway features into TableGateways created as part of the Apigility DB-Connected functionality.
View TableGatewayFeaturesDelegatorFactory.php
<?php
use Zend\Db\TableGateway\Feature;
use Zend\ServiceManager\DelegatorFactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
class TableGatewayFeaturesDelegatorFactory implements DelegatorFactoryInterface
{
public function createDelegatorWithName(
ServiceLocatorInterface $services,
@weierophinney
weierophinney / OAuth2PdoAdapterFactory.php
Created Aug 5, 2014
Example of pulling a PDO connection from an existing ZF2 DB adapter in order to seed a ZF\OAuth2\Adapter\PdoAdapter instance.
View OAuth2PdoAdapterFactory.php
<?php
use ZF\OAuth2\Adapter\PdoAdapter;
class OAuth2PdoAdapterFactory
{
public function __invoke($services)
{
$db = $services->get('DB\MyDbName');
if (! $db instanceof Adapter) {
@weierophinney
weierophinney / response.md
Created Oct 9, 2014
A comment posted to blog.weblicious.net
View response.md

In response to: http://blog.weblicious.net/2014/10/where-most-of-our-articles-are-coming-from/

The comment is currently marked as moderated; I don't expect it will be approved.


Then link directly to the original article, and indicate the original author. Feeds provide both of these pieces of information. Right now, ALL articles indicate they are written by Ali El Manini (though I will admit that many include the original author in the title, the author listed is Ali, in both the articles and the feed). NONE of them link back to the original — which is alone enough reason for people to ask that you stop republishing. Add on to this that many are clearly the truncated versions aggregated by Planet PHP (which PROPERLY attributes the original author and links back to the original article), there’s even less indication of how to find the original in order to get the full version.

At the very least, this site adds confusion to the google results for given topics. It definitely violates copyright by republ

View listener.php
<?php
function injectLogoLink($e)
{
$halEntity = $e->getParam('entity');
$halEntity->getLinks()->add(\ZF\Hal\Link\Link::factory(
'rel' => 'logo',
'route' => array(
'name' => 'cart-logo',
'params' => array(
'id' => $halEntity->id,
@weierophinney
weierophinney / collection.php
Created Nov 24, 2014
Example of creating a collection with extra attributes.
View collection.php
<?php
$collection = new \ZF\Hal\Collection($actualCollectionUsuallyAPaginator);
$collection->setAttributes([
'name' => 'BQSLIB',
'description' => 'BQSLib',
'creationDate' => '2010-11-08 12:12:42',
]);
// Either add this as a property of the entity, or return it.
You can’t perform that action at this time.