Skip to content

Instantly share code, notes, and snippets.

View niisan-tokyo's full-sized avatar

NIIKURA Ryota niisan-tokyo

  • ROXX
  • Japan, Tokyo, Bunkyoku
View GitHub Profile
@niisan-tokyo
niisan-tokyo / ElasticSearchQueryBuilder.php
Created October 21, 2023 06:45
ElasticSearchのクエリビルダとそのテスト。テスト駆動開発の例として使う。
<?php
namespace Niisan\PhpElasticsearchQuerybuilder;
class QueryBuilder
{
private array $query = [];
private string $mode = 'must';
public function match(string $field, string $content): self
@niisan-tokyo
niisan-tokyo / ImplementGenerator.php
Last active November 4, 2020 06:57
interfaceから実装を作るジェネレータ
<?php
namespace Niisan\App\Generator;
use Reflection;
use ReflectionClass;
use ReflectionMethod;
use RuntimeException;
class ImplementGenerator
{
@niisan-tokyo
niisan-tokyo / lesson2_inclement.php
Last active June 22, 2018 01:49
Docker handson code snipet
<?php
$sum = 0;
for ($i = 1; $i < 10; $i++) {
$sum += $i;
}
echo $sum;
@niisan-tokyo
niisan-tokyo / index.html
Last active February 25, 2021 12:47
ブラウザから動画を録画する機構
<!DOCTYPE html>
<html lang="ja" dir="ltr" itemscope itemtype="http://schema.org/Article">
<head>
<meta charset="utf-8">
</head>
<body>
<div class="camera">
<video id="video">Video stream not available.</video>
</div><br>
<button id="startbutton">start!!</button><button id="stopbutton">stop!!</button><button id="download">download!!</button><br>
@niisan-tokyo
niisan-tokyo / create_data.php
Last active October 8, 2017 04:32
時系列データの予測をphpnnをしようして作ってみました。effect( 学習率 )がやたらでかいですが、何故かこれでうまく言ったので
<?php
$output = '../data/timeline_data';
$number = 10000;// 生成するデータ数
$tnum = $number * 0.1;// テストに使用するデータ数
$samples = 32;// 時系列の予測に使用する連続したデータ点の個数
$answers = 10;// 予測する次の連続したデータ点の個数
$raw_data = [];
$pi = pi();
@niisan-tokyo
niisan-tokyo / Ranking.php
Last active November 1, 2021 05:07
Ranking class using redis extension
<?php
namespace NiisanTokyo;
/**
* ランキング生成・取得クラス
*
* phpredis エクステンションが必要
*
* @see https://github.com/phpredis/phpredis
*/
@niisan-tokyo
niisan-tokyo / MysqlWrapper.php
Last active February 26, 2022 09:54
Asynchronous MySQL code
<?php
namespace NiisanTokyo\As2sm;
use Evenement\EventEmitter;
use React\EventLoop\LoopInterface;
/**
* The asynchronous wrapper for MySQL
*/