Skip to content

Instantly share code, notes, and snippets.

View MugeSo's full-sized avatar

TANAKA Koichi MugeSo

View GitHub Profile
@MugeSo
MugeSo / ReadableCodeExample.php
Last active December 10, 2015 02:58
Readable code example.
<?php
class Person
{
/** @var Person */
private $_partner;
/** @var Culture */
private $_culture;
@MugeSo
MugeSo / gist:4221423
Created December 6, 2012 02:45
TemporaryInternalEncoding
<?php
class TemporaryInternalEncoding
{
private $_originalEncoding;
public function __construct($encoding)
{
$this->_originalEncoding = mb_internal_encoding();
mb_internal_encoding($encoding);
}
@MugeSo
MugeSo / FeatureContext.php
Created October 29, 2012 02:41
How to use "Diggin - Guzzle AutoCharsetEncoding plugin" with Behat MinkExtension
use Behat\MinkExtension\Context\MinkContext;
use Diggin\Bridge\Guzzle\AutoCharsetEncodingPlugin\AutoCharsetEncodingPlugin;
class FeatureContext extends MinkContext
{
/* ommitted */
/**
* @BeforeScenario
@MugeSo
MugeSo / gist:3148548
Created July 20, 2012 03:58
Render a view without asking.
<?php
interface HearerInterface
{
public function retain($key, $value);
}
interface SelfExpressableInteface
{
public function expressSelf(HearerInteface $hearer);
}
$ behat
フィーチャ: 検索機能
欲しい商品を見つけるために
会員または非会員として
商品を検索できる
シナリオ: カメラを検索する # features/search.feature:7
前提 "ショッピングトップ" を表示している
もし "検索窓" に "カメラ" と入力する
かつ "検索" ボタンをクリックする
# language: ja
フィーチャ: 検索機能
欲しい商品を見つけるために
会員または非会員として
商品を検索できる
シナリオ: カメラを検索する
前提 "ショッピングトップ" を表示している
もし "検索窓" に "カメラ" と入力する
かつ "検索" ボタンをクリックする
@MugeSo
MugeSo / gist:1626063
Created January 17, 2012 10:06
$hoge.foo(); on php without any errors.
error_reporting(E_ALL);
function foo(){}
class Hoge{ public function __toString(){return "a";}}
$hoge = new Hoge();
$hoge.foo();// Success!