Skip to content

Instantly share code, notes, and snippets.

View RWOverdijk's full-sized avatar
🤠
What's going on!?

Roberto Wesley Overdijk RWOverdijk

🤠
What's going on!?
View GitHub Profile
@RWOverdijk
RWOverdijk / gittyup.sh
Created February 9, 2012 20:07 — forked from EvanDotPro/gittyup.sh
Easily keep master in sync with upstream.
####################################################################################
## ##
## gittyup() - Easily keep master in sync with upstream. ##
## ##
## Author: Evan Coury, http://blog.evan.pro/ ##
## URL: https://gist.github.com/1506822 ##
## ##
## This bash function is a simple shortcut for keeping your local (and public ##
## fork / origin remote) master branch up to date and in sync with the upstream ##
## master. To use gittyup(), simply drop this in your ~/.bashrc. ##
@RWOverdijk
RWOverdijk / CustomLocator
Created April 16, 2012 14:56
Get custom data from custom files, nested in folders.
<?php
namespace Application\Custom;
use Zend\Config\Factory as ConfigFactory;
class Locator
{
const DEFAULT_CUSTOM = '_default';
const CUSTOM_DIRECTORY = '_custom';
@RWOverdijk
RWOverdijk / JsonModel
Created May 22, 2012 19:24 — forked from basz/JsonModel
Inside my controller, as long as result is Traversable or is an object with public props it works...
public function getTransactionDataAction()
{
try {
if ($this->transaction == false || $this->transaction->getStatus() != Transaction::STATUS_COMPLETED) {
return $this->envelopeResult(false, sprintf(self::ERR_INCORRECT_TRANSACTION, $this->_transaction));
}
return $this->envelopeResult(true, $this->transaction->toArray());
} catch (\Exception $e) {
return $this->envelopeResult(false, $e->getMessage());
@RWOverdijk
RWOverdijk / cms route
Created May 23, 2012 20:44
cms route
'routes' => array(
'cms' => array(
'type' => 'Regex',
'priority' => '-1000',
'options' => array(
'route' => '/(?<slug>.*)',
'defaults' => array(
'controller' => 'index',
'action' => 'page',
),
@RWOverdijk
RWOverdijk / gist:2911788
Created June 11, 2012 18:31
ZfcUser Exception
Catchable fatal error: Argument 1 passed to ZfcUser\Controller\Plugin\ZfcUserAuthentication::setServiceManager() must be an instance of Zend\ServiceManager\ServiceManager, instance of ZfcUser\Controller\Plugin\ZfcUserAuthentication given, called in /home/wesley/sites/spoonx/vendor/zendframework/zendframework/library/Zend/Mvc/Service/ServiceManagerConfiguration.php on line 177 and defined in /home/wesley/sites/spoonx/vendor/ZfcUser/src/ZfcUser/Controller/Plugin/ZfcUserAuthentication.php on line 112
wesley@ubuntu-wesley:~/sites/spoonx$ sudo php composer.phar update
Updating dependencies
- Updating zendframework/zendframework (dev-master)
[RuntimeException]
Source directory /home/wesley/sites/spoonx/vendor/zendframework/zendframework has
uncommitted changes
/**
* Set a value in the config.
*
* @param string $name
* @param mixed $value
* @return void
* @throws Exception\RuntimeException
*/
public function __set($name, $value)
{
@RWOverdijk
RWOverdijk / gist:3346790
Created August 14, 2012 06:00
implements newline
class Module implements
AutoloaderProviderInterface,
ConfigProviderInterface,
BootstrapListenerInterface
{
<?php
namespace Cms\Mapper;
use ZfcBase\Mapper\AbstractDbMapper;
class Slug extends AbstractDbMapper implements DbAdapterAwareInterface
{
protected $tableName = 'slugs';
if ($assetManager->serveAsset($application->getRequest())) {
// enforcing application stop - does still allow EVENT_FINISH
$evm = $application->getEventManager();
$evm->clearListeners(MvcEvent::EVENT_DISPATCH);
$evm->clearListeners(MvcEvent::EVENT_DISPATCH_ERROR);
$evm->clearListeners(MvcEvent::EVENT_ROUTE);
$evm->clearListeners(MvcEvent::EVENT_RENDER);
// @todo also detach from shared event manager?
// @todo this could also be avoided if we move the asset manager to a controller and use the standard MVC