Skip to content

Instantly share code, notes, and snippets.

View mpinkston's full-sized avatar

Matt Pinkston mpinkston

  • TableCheck Inc
  • Tokyo, Japan
View GitHub Profile
defmodule MyApp.Guardian.KeyServer do
@moduledoc ~S"""
A simple GenServer implementation of a custom `Guardian.Token.Jwt.SecretFetcher`
This is appropriate for development but should not be used in production
due to questionable private key storage, lack of multi-node support,
node restart durability, and public key garbage collection.
"""
use GenServer
@mpinkston
mpinkston / gist:4002056
Created November 2, 2012 15:36
simple routing
/* http://mysite.com/security/dashboard/some-action */
array(
'router' => array(
'routes' => array(
'security' => array(
'type' => 'Segment',
'may_terminate' => true,
'options' => array(
'route' => '/security[/:controller[/:action]]',
@mpinkston
mpinkston / Mvc_Controller_Plugin_View.php
Created October 29, 2012 14:03
ZF2 controller plugin that configures a view with a specified template and optionally injects it into the layout.
<?php
namespace Base\Mvc\Controller\Plugin;
use Zend\View\Exception;
use Zend\View\Model\ViewModel;
use Zend\Mvc\MvcEvent;
use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\Controller\Plugin\Layout;
use Zend\Mvc\View\Http\InjectTemplateListener;