Skip to content

Instantly share code, notes, and snippets.

View koriym's full-sized avatar

Akihito Koriyama koriym

View GitHub Profile
return function (
string $context,
string $name,
string $ip,
int $port,
int $mode = SWOOLE_BASE,
int $sockType = SWOOLE_SOCK_TCP,
array $settings = ['worker_num' => 4]
) : int {
$http = new Server($ip, $port, $mode, $sockType);
@koriym
koriym / file0.txt
Created December 17, 2018 08:34
macOS MojaveでLiip PHPのインストール ref: https://qiita.com/koriym/items/7c1b42338586c495089f
sudo apachectl stop`
sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null`
@koriym
koriym / file0.php
Created December 17, 2018 07:34
ディレクトリ内のファイルの消去 ref: https://qiita.com/koriym/items/b7e60f621b9a0a868d7f
array_map('unlink', glob("path/to/dir/*.php"));
@koriym
koriym / Day_of_the_Programmer.php
Created September 13, 2018 12:09
Happy Programmer's day !
<?php
// @see https://en.wikipedia.org/wiki/Day_of_the_Programmer
if (date("z") + 1 === 256) {
echo "Happy Programmer's day !" . PHP_EOL;
}
@koriym
koriym / 問題解決の鍵はbounded context.md
Last active August 30, 2018 13:52
問題解決の鍵はbounded context
  1. bounded contextがあやふやな「悪いモノリス」と、契約のある「良いモノリス」とがある。
  2. 初期段階での性能差は低いが、前者はスケールの限界が早期に訪れ、後者は基本的には限界はほぼ無い。
  3. 前者の問題をマイクロサービスで解決しようとすると、分割された泥だんごができる。http://www.codingthearchitecture.com/2014/07/06/distributed_big_balls_of_mud.html
  4. m/sはReliabilityの問題を軽視してはいけない https://twitter.com/ircmaxell/status/1006631401603514368
  5. m/sはシステムを複雑にする。自動化やツールのための専門のスタッフが必要。 https://twitter.com/ircmaxell/status/908647840196513792
  6. 問題解決の鍵はbounded context。(=interface) これはm/sに優先する。
  7. HTTP APIにはmedia type / content-negotiation / json-schema (+hyper-scehma)などのhttp semanticsを。
  8. サービスのbounded contextを設計するのがAPIアーキテクト。示された「API構造」にシステムのbounded contextを設計して、ソフトウエア構造を与えるのが、ソフトウエアアーキテクト。
  9. APIはシステムのUI。APIアーキテクトはシステムUIデザイナー。
@koriym
koriym / 大東亜戦争開戦の詔書.md
Created August 18, 2018 18:44
大東亜戦争開戦の詔書

大東亜戦争開戦の詔書

天佑ヲ保有シ萬世一系ノ皇祚ヲ踐メル大日本帝國天皇ハ昭ニ忠誠勇武ナル汝有眾ニ示ス

天からの恵み、助けを受け、万世一系の皇位を継ぐ私、大日本帝国天皇は、ここに忠誠勇武なる汝ら臣民に示す。

朕玆ニ米國及英國ニ對シテ戰ヲ宣ス朕カ陸海將兵ハ全力ヲ奮テ交戰ニ從事シ朕カ百僚有司ハ勵精職務ヲ奉行シ朕カ眾庶ハ各〻其ノ本分ヲ盡シ億兆一心國家ノ總力ヲ擧ケテ征戰ノ目的ヲ逹成スルニ遺算ナカラムコトヲ期セヨ

私はアメリカおよびイギリスに対し、宣戦を布告する。我が帝国の陸海将兵諸君は全力を奮い交戦に従事し、我が帝国のすべての政府関係者は職務に励んでこれに身を捧げ、我が帝国の庶民らはおのおのその本分を尽くし、すべての心をひとつにして、国家が総力を挙げこの戦争の目的を達成するための力とせよ。

@koriym
koriym / turkish_airlines_customer_services_template.txt
Created August 8, 2018 01:26
Turkish Airlines Customer Services Feedback Template
Dear {{ name }},
Thank you for contacting Turkish Airlines Customer Services and informing us about your experience.
Unfortunately it is not completely avoidable that this kind of events happen. Currently we are working on developing a solution for this issue. We are performing an upgrade our service channels to improve our infrastructure. Turkish Airlines' aim is always to improve and offer the best service.
In order to check necessary evaluation please create a booking without payment and inform us with a new feedback.
AsTurkish Airlines we sincerely apologize for the inconvenience that you have experienced.
<?php
class AuthException extends \RuntimeException
{
}
final class UserToken
{
public $jwtToken;
// 他に必要なプロパティ
Benchmarking 127.0.0.1 (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
apr_socket_recv: Operation timed out (60)
@koriym
koriym / injection.php
Last active May 30, 2018 08:06
Should dependency injector only do injections ?
<?php
// Should injections only do injections ?
// current - "get"Instance()
$injector = new Injector(new Bindings);
// get instance by interface name
$foo = $injector->getInstance(FooInterface::class);