Skip to content

Instantly share code, notes, and snippets.

View asaokamei's full-sized avatar

Asao Kamei asaokamei

View GitHub Profile
@asaokamei
asaokamei / compare.php
Created December 11, 2011 12:32
compare __, arry, and _ww performance.
<?php
/**
* compare performance of underscore.php, arry.php, and _ww.php.
*/
require_once __DIR__ . '/../Underscore.php/underscore.php';
require_once __DIR__ . '/../arry/Arry.php';
require_once __DIR__ . '/../_ww/_ww.php';
/**
@asaokamei
asaokamei / ClassLoader.php
Created January 16, 2012 13:50
ClassLoader for PSR-0 using closure.
<?php
/**
* SPL Class Loader for NameSpace classes using closure.
* ex: spl_autoload_register( ClassLoader() );
* copied from https://gist.github.com/221634
* @param $path
* @param array $option
* @return closure
*/
@asaokamei
asaokamei / DiInterface.php
Created September 15, 2012 00:39
Automatic Dependency Injection using Interface
<?php
/*
Example of simple automatic dependency injection using only interface.
this code is equivalent to:
$service = new \MyService\Service;
$invoice = new \Application\Invoice;
@asaokamei
asaokamei / Tags.php
Created September 19, 2012 02:39
PHP HTML Tag Generator Class.
<?php
/**
* @method Tags a()
* @method Tags href()
* @method Tags target()
* @method Tags style()
* @method Tags div()
* @method Tags input()
* @method Tags value()
@asaokamei
asaokamei / Interaction.php
Created December 1, 2012 21:51
an interaction demo.
<?php
namespace wsModule\Alt\Web;
/**
* Interaction for web input and output, such as forms.
* This is a DCI inspired module. things works as coded but still quite experimental.
*
* TODO: remove $this->view property. Interaction should not know about view...
*/
class Interaction
@asaokamei
asaokamei / sample.md
Last active December 14, 2015 06:39
Markdown examples

Markdown examples

This is for Github flabored Markdown format.

Lists

  • list without numbers.
  • and the items follow.
@asaokamei
asaokamei / gist:5691992
Last active December 17, 2015 23:49
count lines of php code

Counting Lines of PHP Codes

###How to Count

use simple shell scripts. modify the following command as necessary.

wc -l `find . -name "*.php"`
@asaokamei
asaokamei / gist:5692180
Last active December 17, 2015 23:49
Diコンテナの名前空間に関するメモ

Diコンテナの名前空間に関するメモ

自作Diコンテナに「名前空間」を実装してみた。 欲しいと思った理由をまとめてみました。

WScore/DiContainer : https://github.com/asaokamei/WScore.DiContainer

自動設定の問題点

@asaokamei
asaokamei / gist:6260020
Last active December 21, 2015 05:49
WScore-dev performance measurement result as of 2013/08/18.

localhost/ws/contacts

###prod setup

  • Requests per second: 39.24 #/sec (mean)
  • Time per request: 25.484 ms (mean)

###normal setup

@asaokamei
asaokamei / gist:6266426
Created August 19, 2013 07:15
モデル、ページオブジェクトのキャッシュ効果測定

モデル、ページオブジェクト

BEAR.Sundayで覚えたアプリオブジェクト全部をキャッシュ(APC)する荒業。 その効果についてxdebugのprofileで効果を測定。

結果

Response/Moduleのinstantiateメソード内で、生成するオブジェクトを変更して、プロファイルをチェック。