Skip to content

Instantly share code, notes, and snippets.

View koriym's full-sized avatar

Akihito Koriyama koriym

View GitHub Profile
@dave1010
dave1010 / to-string.php
Created June 10, 2011 15:02
How to throw exceptions in a PHP class' __toString method
<?php
class MyClass {
public function __toString() {
try {
return $this->render();
} catch(Exception $e) {
// the __toString method isn't allowed to throw exceptions
// so we turn them into an error instead
trigger_error($e->getMessage() . "\n" . $e->getTraceAsString(), E_USER_ERROR);
@smizell
smizell / vnd.error.xml
Created July 31, 2014 20:55
ALPS doc for defining semantics and links for error messages, as taken from the vnd.error media type
<alps version="1.0">
<descriptor id="error" type="semantic">
<doc>Error Message</doc>
<descriptor id="message" type="semantic">
<doc>
For expressing a human readable message related to the current error which may be displayed to the user of the api
</doc>
</descriptor>
@koriym
koriym / SqlTest.php
Created May 16, 2019 03:31
SQLテストテンプレート
<?php
use Aura\Sql\ExtendedPdoInterface;
use BEAR\Package\AppInjector;
use Koriym\QueryLocator\QueryLocatorInterface;
use PHPUnit\Framework\TestCase;
use Ray\Di\InjectorInterface;
use Ray\Query\RowInterface;
/**
@koriym
koriym / BEAR.Sunday.design.md
Created July 28, 2011 16:15
BEAR.Sunday design
@mamund
mamund / 2020-01-23b.js
Last active January 24, 2020 13:56
self-describing messages
/*
who does it better?
*/
// this
{
"rel" : "http://example.org/vocabularies/customer-communiations#customers/update-name-and-sms"
"href" : "http://example.org/customers/123"
"type" : "..."
}
<?php
// iterator impl:
class MapIterator extends IteratorIterator {
private $f;
public function __construct($f, $inner) {
parent::__construct($inner);
$this->f = $f;
@juno
juno / github-flow.ja.md
Last active April 9, 2021 02:20
GitHub Flow (Japanese translation) Latest version is here: https://gist.github.com/Gab-km/3705015

GitHub Flow

31 Aug 2011

git-flowの問題点 (Issues with git-flow)

私は人々にGitを教えるためにあちこちを飛び回っているが、最近のほぼすべてのクラスやワークショップでgit-flowについてどう思うかを尋ねられた。私はいつも、git-flowは素晴らしいと思うと答えている。何百万ものワークフローを持ったシステム(Git)を提供し、ドキュメントもあるし、よくテストされている。フレキシブルなワークフローは、実に容易なやり方で多くの開発者の役に立つ。標準的なものになりつつあり、開発者はプロジェクトや企業の間を移動しつつこの標準的なワークフローに馴染むことができる。

@salathe
salathe / results.txt
Created January 24, 2012 20:55
PHP array/string functions haystack/needle ordering
Array functions:
array_search $needle, $haystack
in_array $needle, $haystack
String functions:
strchr $haystack, $needle
stripos $haystack, $needle
stristr $haystack, $needle
strpos $haystack, $needle
strrchr $haystack, $needle