This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait EnumTrait | |
{ | |
/** @var static[] */ | |
private static $instance; | |
/** @var mixed value of constant */ | |
private $value; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
final class GameDifficulty | |
{ | |
const HARD = 'hard'; | |
const NORMAL = 'normal'; | |
const EASY = 'easy'; | |
use EnumTrait { | |
constant as public HARD; | |
constant as public NORMAL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ParentClassA { function f(stdClass $a) {} } | |
class ChildClassA extends ParentClassA { function f($a) {} } | |
/* | |
7.2 の Parameter Type Widening (https://wiki.php.net/rfc/parameter-no-type-variance) によって、 | |
上記 ParentClassA/ChildClassA は ok になった。 | |
(new ParentClassA())->f(new stdClass()) に対して |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# スレッドA,B 生成前に実行 | |
> create table t1( id int not null auto_increment, hoge varchar(255) not null, primary key(id) )engine=innodb; | |
> insert into t1 values (1, "hoge"); | |
スレッドA | |
> drop table t1; | |
> create table t1( id int not null auto_increment, primary key(id) )engine=innodb; | |
> insert into t1 values (1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
use Symfony\Component\DomCrawler\Crawler; | |
$html = <<<'HTML' | |
<!doctype html> | |
<form> | |
<input type="image" name="date[2016-03-16]" /> | |
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html ng-app> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.3/angular.min.js"></script> | |
<script src="http://code.angularjs.org/1.2.3/angular-animate.min.js"></script> | |
<script> | |
function ctrl($scope) { | |
$scope.words = []; | |
$scope.input = function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait GeneratorAction { | |
private $_g; | |
public function initializeGenerator($g) { | |
$this->_g = $g; | |
} | |
public function getGenerator() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################### | |
# usage | |
# mylogin_dumper.pl ~/.mylogin.conf | |
###################################### | |
use strict; | |
use warnings; | |
use Crypt::ECB; | |
#use Crypt::OpenSSL::AES; | |
my $my_login_file = shift; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('$PATH_TO_LIBRARY/HTMLPurifier.includes.php'); | |
use HTMLPurifier; | |
use HTMLPurifier_Config; | |
function sanitize($tainted_html) { | |
$config = HTMLPurifier_Config::createDefault(); | |
$config->set('Cache.SerializerPath', $PATH_TO_TEMPORARY_DIR); | |
$purifier = new HTMLPurifier($config); | |
return $purifier->purify($tainted_html); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="ja"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>日本語csv sample</title> | |
</head> | |
<body> | |
<a id="js-download" href="dummy">download</a> | |
<script> | |
// (1) BOM の用意 |
NewerOlder