Skip to content

Instantly share code, notes, and snippets.

View koriym's full-sized avatar

Akihito Koriyama koriym

View GitHub Profile
@koriym
koriym / gist:490adf441037bae0167f
Created September 13, 2014 03:24
Ray.Di car example
<?php
use Ray\Di\ProviderInterface;
use Ray\Di\Di\Inject;
interface CarInterface{}
interface CarConfigInterface{}
class CarConfig extends \ArrayObject implements CarConfigInterface{}

Ray.Di v2

  • BC Break ?
  • Parameter injection in v2.x ?

BEAR.Sunday 1.0alpha

  • min
  • MinPackage (router + resource + json)
// original
$this['events'] = $this->resource->get->uri('app://spout/resources/listing')
->withQuery([
'type' => 'event',
'sort' => 'datetime'
])
->eager
->request()['resources'];
// link
@koriym
koriym / gist:6cdb82fe5ebf8fe219bd
Last active August 29, 2015 14:11
Syntax suger of get request
/**
* @param string|Uri $uri
* @param array $query
*
* @return callable
*/
function resource($uri, array $query)
{
$resource = (new Injector(new AppModule, __DIR__ . '/tmp'))->getInstance(ResourceInterface::class);
$request = $resource->get->uri($uri)->withQuery($query)->eager->request();
@koriym
koriym / gist:0933973ce159f71575a2
Created January 13, 2015 05:55
Router interface
Aura v2 https://github.com/auraphp/Aura.Router/blob/d50ad32e20409bd7fc8522dc81bf220b35c974aa/src/Router.php
public function match($path, array $server = array())
Symfony http://api.symfony.com/2.0/Symfony/Component/Routing/RouterInterface.html
public array match(string $pathinfo);
ZF2 http://framework.zend.com/manual/current/en/modules/zend.mvc.routing.html
public function match(Request $request);
PHP-Router https://github.com/dannyvankooten/PHP-Router/blob/master/src/PHPRouter/Router.php#L72
@koriym
koriym / gist:d45133f50941d3803772
Created April 21, 2015 03:54
最初のDependencyCompilerTest
<?php
namespace Ray\Di;
use Ray\Aop\Compiler;
use Ray\Aop\Matcher;
use Ray\Aop\Pointcut;
use Ray\Aop\WeavedInterface;
class DependencyCompilerTest extends \PHPUnit_Framework_TestCase
@koriym
koriym / .bash_profile
Last active September 13, 2016 05:34
bash_profile
# macports
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# PHP
export PATH="/usr/local/php5/bin:$PATH"
# mysql
export PATH="/usr/local/mysql/bin/:$PATH"
# composer
export PATH="$HOME/.composer/vendor/bin:$PATH"
# npm
export PATH="./node_modules/.bin:$PATH"
@koriym
koriym / v8js.md
Last active May 2, 2016 07:57
v8js for MacOS

How to install latest v8 (5.x) on MacOS

Compile latest v8

# Install depot_tools first (needed for source checkout)
# https://github.com/phpv8/v8js/blob/php7/README.MacOS.md
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
@koriym
koriym / ssr.html
Created May 8, 2016 04:30
SSR code sample
<!doctype html>
<html>
<head>
<title>React page</title>
<!-- css and stuff -->
</head>
<body>
<!-- render server content here -->