Skip to content

Instantly share code, notes, and snippets.

View basz's full-sized avatar

Bas Kamer basz

View GitHub Profile
public static function from(
$addressee = null,
$street = null,
string $streetOrdinality = null,
string $streetOrdinalitySuffix = null,
string $postalCode = null,
string $populatedPlace = null,
string $country = null,
string $countryRegion = null,
string $geoLocation = null
_getFormatter: (format) => {
let formatter = this.getWithDefault(`converters.${format}`, false);
if (false === formatter) {
throw `unknown formatter`;
}
return formatter;
},
sideSidebarCollapse: true,
actions: {
toggleSidebarCollapse() {
this.toggleProperty('sideSidebarCollapse');
}
}
$mock->expects($this->any())
->method('doSomething')
->with($valueCreatedInsideTestedObject)
->willReturn($valueCreatedInsideTestedObject);
private $property;
public function method()
{
$token = new self();
$token->property = 'something'; // feels like a violation of the private accessor, but indeed it is not....
}
@basz
basz / bin:doctrine.php
Last active January 22, 2016 15:14
make vendor/bin/doctrine work with zend-expressive
/**
* A alternative to the above;
* ./vendor/bin/doctrine.php won't work, but you can add more commands shown as here with the migration tasks
*/
// ./bin/doctrine.php
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
public function hasUse($use)
{
$uses = array_values($this->uses);
foreach($this->uses as $key=>$value) {
$parts = explode(' ', $value);
if ($parts[0] === $use) {
return true;
}
}
@basz
basz / ZendAuthenticationServiceMiddleware
Last active November 18, 2015 21:40
ZfcRbac\Middleware\ZendAuthenticationServiceMiddleware
<?php
namespace ZfcRbac\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Authentication\AuthenticationService;
use Zend\Stratigility\MiddlewareInterface;
class ZendAuthenticationServiceMiddleware implements MiddlewareInterface
class SomePluginManager extends AbstractPluginManager
{
/**
* @var array
*/
protected $invokableClasses = [
'ZfcRbac\Role\InMemoryRoleProvider' => 'ZfcRbac\Role\InMemoryRoleProvider'
];
}
---
- name: mysql | s3 import | apt packages
apt: name={{ item }} state=present
with_items:
- unzip
- python-pip
- name: mysql | s3 import | pip packages
pip: name={{ item }} state=present