Skip to content

Instantly share code, notes, and snippets.

@sasezaki
sasezaki / phpunit34.sh
Created December 9, 2011 12:50
Use old PHPUnit (3.4 & 3.5) by installed via pyrus
#!/bin/sh
PYRUS=/path/to/pyrus.phar
php $PYRUS . set bin_dir ./bin
pear download components.ez.no/Base
pear download components.ez.no/ConsoleTools
php $PYRUS . channel-discover pear.phpunit.de
php $PYRUS . channel-discover components.ez.no
php $PYRUS . channel-discover pear.symfony-project.com
php $PYRUS . install Base-1.8.tgz
php $PYRUS . install ConsoleTools-1.6.1.tgz
@sasezaki
sasezaki / yapcasia-8oji-2016mid-timetable_propose.md
Last active August 17, 2016 09:52
『Zend Framework その11年』という題で考えたけれども

表記するお名前、SNSアカウント

sasezaki http://twitter.com/sasezaki

概要

Zend Framework というプロダクト・コンセプトが世にでてから11年が経過しようしています。この発表では、私がZend Frameworkを中心に PHPのOSSに関する各種トピックについて感じたことを振り返って見たいと思います。

  • 導入
  • Zend Framework 登場前
@sasezaki
sasezaki / ADtoRegnalYear.php
Created July 14, 2016 13:20
AD to RegnalYear 西暦から元号に変換(元号新規追加されてもデータセットをコンテナ注入すればいい版)
<?php
/**
* 西暦から元号に変換(元号新規追加されてもデータセットをコンテナ注入すればいい版)
*
* @see http://tohokuaiki.hateblo.jp/entry/20110314/1300090600
* @see https://github.com/mattn/go-era_jp
*/
declare(strict_types=1);
class YearValue
@sasezaki
sasezaki / filter.php
Created July 2, 2016 16:05
filter value for nested array
<?php
$post = [
'k' => 'v',
'kk' => [
'll' => 'あああ',
'l2' => [
['xCode' => 'おおお'],
['x2Code' => 'おおお'],
'm1' => [
@sasezaki
sasezaki / hydrator_desirializer.php
Last active June 21, 2016 11:28
tasting implementation hydrator, serializer
<?php
declare(strict_types=1);
namespace ClassHydrator {
interface ClassHydrationInterface
{
public function hydrate(array $data, string $className);
}
@sasezaki
sasezaki / zend-mvc-mini.php
Created June 19, 2016 03:03
example , run zend-mvc minimal for debug
<?php
// INSTALL: $composer require zendframework/zend-mvc:^3
// USAGE: $php -d allow_url_include=1 zend-mvc-mini.php
namespace Application {
use Zend\Router\Http\Literal;
use Zend\Router\Http\Segment;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\ServiceManager\Factory\InvokableFactory;
@sasezaki
sasezaki / zundoko.php
Created April 4, 2016 14:19
ズンドコキヨシ・コーディングに対する感想
<?php
/**
* ズンドコキヨシ・コーディングに対する感想
*
* 設問から派生したところを考えた場合、
* ズンドコキヨシ問題をPHPとFSMで解く http://developer.cybozu.co.jp/akky/2016/03/zundoko-kiyoshi-in-php-and-fsm/
* などは導入したほうが分かりやすくなる例としてなるほどなとは思ったり、
* 短くするコードゴルフ始めてたりしてフーン(読みにくっ)と思ったり
*
<?php
use Zend\Paginator\Paginator;
use Zend\Db\Adapter\Adapter;
use Zend\Cache\StorageFactory;
use Zend\Db\TableGateway\TableGateway;
require_once 'vendor/autoload.php';
$adapter = new Zend\Db\Adapter\Adapter(array(
'driver' => 'Pdo_Sqlite',
@sasezaki
sasezaki / CacheAdapter.php
Created January 25, 2016 15:54
zend paginator cache renew
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace Zend\Paginator\Adapter;
@sasezaki
sasezaki / 23658.diff
Last active January 25, 2016 14:49
zf1 paginator diffs
Index: Adapter/DbSelect.php
===================================================================
--- Adapter/DbSelect.php (revision 23657)
+++ Adapter/DbSelect.php (revision 23658)
@@ -100,7 +100,9 @@
if ($rowCount instanceof Zend_Db_Select) {
$columns = $rowCount->getPart(Zend_Db_Select::COLUMNS);
- $countColumnPart = $columns[0][1];
+ $countColumnPart = empty($columns[0][2])