Skip to content

Instantly share code, notes, and snippets.

View o0h's full-sized avatar
😀
Working from home

Hideki Kinjyo o0h

😀
Working from home
View GitHub Profile
@o0h
o0h / 集計のためのメインロジック.sh
Created October 29, 2023 04:51
ブログ用: staabm/phpstan-baseline-analysisをGitHub Actions上で遊ぶ
#!/usr/bin/env bash
pj_root_dir="$(dirname "$(readlink -f "$0")")"
target_dir="${pj_root_dir}/nanika-no-pj-src/.phpstan-baselines"
# ポイント①
pushd nanika-no-pj-src
for ((day_before=0; day_before<=60; day_before++)); do
# ポイント②
@o0h
o0h / @を許さないルール.php
Last active October 5, 2023 14:09
PHPStanを利用してエラー制御演算子の利用を検出する
<?php
declare(strict_types=1);
namespace O0h\PhpstanErrorControlOp\Rules;
use PhpParser\Node;
use PHPStan\Analyser\Scope;
use PHPStan\Rules\Rule;
use PHPStan\Rules\RuleErrorBuilder;
@o0h
o0h / php-ast-diff-check.php
Last active August 15, 2023 16:23
PHPのファイルに差分があるかを(astを使って)調べる君
<?php
declare(strict_types=1);
const CHECK_PHP_VERSION = 80;
if (!extension_loaded('ast')) {
abort('php-ast is required, but not installed. Abort.');
}
if ($argc < 2) {
@o0h
o0h / autoload_psr4.php
Created February 25, 2023 12:33
Composerのオートローダーのサンプル
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'Twig\\Extra\\Markdown\\' => array($vendorDir . '/twig/markdown-extra'),
'Twig\\' => array($vendorDir . '/twig/twig/src'),
<?php
$dsn = getenv('SENTRY_DSN');
$urlParts = parse_url($dsn);
$baseUrl = 'http://localhost:3000'; // @see https://docs.sentry.io/product/relay/ for localhost:3000
# $baseUrl = "{$urlParts['scheme']}://{$urlParts['host']}";
$endpoint = "{$baseUrl}/api{$urlParts['path']}/store/";
$headers = [
@o0h
o0h / stan.php
Created February 24, 2021 08:11
PHPStanのmatch式解析がよく分からん・・?
<?php declare(strict_types = 1);
// https://phpstan.org/r/08461790-ec36-4043-8fd4-0c11074d44ea
/**
* @param mixed $a some value
* @return mixed
*/
function returnMatch($a): mixed
{
return match ($a) {
@o0h
o0h / 参考にした記事等のリンク.md
Last active June 29, 2021 06:57
RDS Performance Insights調査メモ

Perfoemance Insights

リファレンス・マニュアル系

講演資料・ブログ等のユースケース紹介系

  • [Using Performance Insights to
@o0h
o0h / github.html
Last active January 5, 2019 09:35
すごく雑なFirebaseAuthenticateログインフォーム
<html>
<head>
<!-- Firebase App is always required and must be first -->
<script src="https://www.gstatic.com/firebasejs/5.5.2/firebase-app.js"></script>
<!-- Add additional services that you want to use -->
<script src="https://www.gstatic.com/firebasejs/5.5.2/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/5.5.2/firebase-database.js"></script>
<script src="https://www.gstatic.com/firebasejs/5.5.2/firebase-firestore.js"></script>
@o0h
o0h / CarDto.php
Created December 9, 2018 05:02
cakephp-dtoプラグインお試し
<?php
/**
* !!! Auto generated file. Do not directly modify this file. !!!
* You can either version control this or generate the file on the fly prior to usage/deployment.
*/
namespace App\Dto;
/**
* Car DTO
@o0h
o0h / travis-action.patch
Last active December 7, 2018 11:15
Travis CI API用のアクション定義
diff --git a/.github-aciton/travis-ci/.gitignore b/.github-aciton/travis-ci/.gitignore
new file mode 100644
index 0000000..ad46b30
--- /dev/null
+++ b/.github-aciton/travis-ci/.gitignore
@@ -0,0 +1,61 @@
+# Logs
+logs
+*.log
+npm-debug.log*