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 | |
| function isBullshit($object) { | |
| return true; | |
| } |
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 | |
| /** | |
| * この値が true だったら彼女ができる | |
| */ | |
| function datsudou() { | |
| // 悲しみのハードコーディング | |
| return false; | |
| } |
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 | |
| $characters = array( | |
| 'eren' => 'エレン・イェーガー', | |
| 'mikasa' => 'ミカサ・アッカーマン', | |
| 'armin' => 'アルミン・アルレルト', | |
| 'jean' => 'ジャン・キルシュタイン', | |
| 'reiner' => 'ライナー・ブラウン', | |
| 'levi' => 'リヴァイ', | |
| 'zoe' => 'ハンジ・ゾエ', | |
| 'erwin' => 'エルヴィン・スミス', |
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 | |
| // $device = 'COM4'; // on Windows | |
| $device = '/dev/ttyUSB0'; // on Linux | |
| /* | |
| * create new instance | |
| */ | |
| $port = new SerialPort(); |
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
| var deleteForm = null; | |
| for (var i = 0; i < document.forms.length; i++) { | |
| var action = document.forms[i].getAttribute("action"); | |
| if (action && action.match(/delete$/)) | |
| deleteForm = document.forms[i]; | |
| } | |
| tdList = document.getElementsByClassName("td-checkbox"); | |
| for (i = 0; i < tdList.length; i++) { | |
| tdList[i].children[0].checked = true; |
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 | |
| $greeting = [0xE4BB8A, 0xE697A5, 0xE381AF, 0xE38081, 0xE38184, 0xE3818B, 0xE3818C, 0xE3818A, 0xE38199, 0xE38194, 0xE38197, 0xE381A7, 0xE38197, 0xE38287, 0xE38186, 0xE3818B, 0xEFBC9F]; | |
| foreach ($greeting as $v) { | |
| print int2bin($v); | |
| } | |
| print PHP_EOL; | |
| function int2bin($i) { | |
| $byte_array = null; | |
| $byte_len = ceil(bitlen($i)/8); |
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 | |
| function base64_encode_recursively($target) { | |
| if (is_array($target)) { | |
| foreach ($target as $key => $value) { | |
| $target[$key] = base64_encode_recursively($value); | |
| } | |
| return $target; | |
| } else if (is_object($target)) { | |
| $property_list = get_object_vars($target); | |
| foreach ($property_list as $key => $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 | |
| $context = null; | |
| $vendor_id = 0x04a9; | |
| $product_id = 0x10d3; | |
| $result_init = usb_init($context); | |
| if ($result_init != USB_SUCCESS) { | |
| die('failed to usb_init(). ' . usb_error_name($result_init)); | |
| } | |
| $config_descriptor = null; |
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 | |
| /* シリアルポートオブジェクトを作ります。 | |
| * この段階ではまだ open していません。 */ | |
| $port = new SerialPort(); | |
| /* open に失敗すると例外がスローされるので | |
| * try catch で例外を補足し、例外処理を適宜行います。 */ | |
| try { | |
| /* ここでは仮に存在しないポートを指定してします。*/ |
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
| #!/usr/bin/env php | |
| <?php | |
| $stdin = fopen('php://stdin', 'r'); | |
| $data = ''; | |
| while(true) { | |
| print '> '; | |
| $data .= fgets($stdin); | |
| if (preg_match('/\\\\$/', $data)==1) { | |
| $data = trim($data, "\x00..\x1F \x5C"); | |
| } else { |