This file contains 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 | |
/** | |
* Code to get all combinations of array elements | |
*/ | |
namespace Macocci7; | |
class Combination | |
{ |
This file contains 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 | |
/** | |
* returns all pairs | |
* @param array $items | |
* @return array | |
*/ | |
function pairs(array $items) | |
{ | |
if (count($items) < 2) { |
This file contains 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 | |
/** | |
* Code for verification of limit on number of array elements | |
*/ | |
// initialization | |
$a = []; | |
// lower limit of array index |
This file contains 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 benchmark(string $name, Closure $callback) | |
{ | |
$start = microtime(true); | |
$callback(); | |
$time = microtime(true) - $start; | |
echo sprintf( | |
"%24s =>\tTime: %.6f sec.\n", | |
$name, |
This file contains 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 | |
use function Laravel\Prompts\text; | |
$name = text( | |
label: 'あなたの名前を入力してください。', | |
placeholder: 'ななし はらぺこ', | |
default: '', | |
hint: 'ここで入力した名前はプロフィールに表示されます。', | |
required: "名前の入力は必須です。", |
This file contains 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 __DIR__ . '/../vendor/autoload.php'; | |
use HeadlessChromium\BrowserFactory; | |
use HeadlessChromium\Clip; | |
use HeadlessChromium\Dom\Dom; | |
use HeadlessChromium\Dom\Selector\CssSelector; | |
use HeadlessChromium\Page; | |
use headlessChromium\Utils; |
This file contains 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 | |
namespace MyLib; | |
class Dir | |
{ | |
/** | |
* Returns all entries in the directory as RecursiveDirectoryIterator | |
* ディレクトリ内の全エントリーをRecursiveDirectoryIteratorで返す | |
* |