Skip to content

Instantly share code, notes, and snippets.

@ngyuki
ngyuki / ec2-route
Last active August 29, 2015 14:07
aws ec2 change route table lsb script
#!/bin/sh
#
# chkconfig: 12345 01 99
# description: EC2 route change
. /etc/rc.d/init.d/functions
prog=${0##*/}
lock=/var/lock/subsys/$prog
<?php
function compose(callable $initial, callable ...$functions)
{
if (count($functions) < 1) {
throw new \InvalidArgumentException('at least two functions are required');
}
return array_reduce($functions, function ($f, $g) {
return function (...$args) use ($f, $g) {
return $f($g(...$args));
@ngyuki
ngyuki / README.md
Last active August 29, 2015 14:06
composer depends graph

Export depends graph by composer

Download graph-composer.phar

wget http://www.lueck.tv/graph-composer/graph-composer.phar

Export PHPUnit depends graph

@ngyuki
ngyuki / index.html
Last active August 29, 2015 14:06
gist sample
this is index.html
<script src="sample.js"></script>
@ngyuki
ngyuki / Await.php
Created September 15, 2014 12:18
PHP のコルーチンを使ったなんかよくわからないもの
<?php
namespace ngyuki\Example\AsyncReceive;
class Await
{
private $has = false;
private $val = false;
public function reset()
{
@ngyuki
ngyuki / README.md
Last active July 15, 2022 15:12
tcp chat by coroutine

[PHP]PHP のコルーチンを使ってみる

PHP 5.5 でコルーチンが実装されましたが、全く使っていなかったので使ってみました。

コルーチンとは

コルーチンとは何なのかというと・・・Wikipedia によると次の通りです。

コルーチン - Wikipedia

@ngyuki
ngyuki / .gitignore
Last active August 29, 2015 14:06
Run phpunit via ssh in phpstorm7 on windows
/vendor
/composer.lock
/*.local.php
/tests
@ngyuki
ngyuki / .php-renderer-sample
Last active August 29, 2015 14:05
PhpRenderer sample
PhpRenderer sample.
@ngyuki
ngyuki / .php-renderer-slide
Last active August 29, 2015 14:05
PhpRenderer slide
PhpRenderer slide.
@ngyuki
ngyuki / vhost.php
Created August 1, 2014 12:43
vhost.php
<?php
/**
* Apache mod_vhost_alias のバーチャルホストの一覧を表示する
*
* ex. httpd.conf
*
* LoadModule vhost_alias_module modules/mod_vhost_alias.so
*
* <VirtualHost *:80>
* ServerName vhost.example.net