Skip to content

Instantly share code, notes, and snippets.

View k4zuki02h4t4's full-sized avatar
🏠
家で働く

K4ZUKI Otsuhata k4zuki02h4t4

🏠
家で働く
View GitHub Profile
@k4zuki02h4t4
k4zuki02h4t4 / discord-voice-widget-horizontal.css
Created November 2, 2024 09:15
discord-voice-widget-horizontal.css
/**
* 幅: 364 (3人分表示する場合)
* 幅: 488 (4人分表示する場合)
* 高さ: 145 (横一列の場合)
*
* アバターを左から順に並べたい場合は、voice-states クラスの justify-content プラパティを削除
* アバターを右から順に並べたい場合は、voice-states クラスに justify-content プラパティを追加して flex-end を指定
**/
:root {
--avatar-count: 3;
@k4zuki02h4t4
k4zuki02h4t4 / amazon.js
Created November 2, 2024 09:13
[ブックマークレット] Amazon の検索結果を Prime & Amazon 販売だけにする
javascript:(function(){var url=top.document.URL;if(url.match(/https.*?amazon/)){document.location.href=url+%27&rh=p_6%3AAN1VRQENFRJN5%2Cp_85%3A8070706051%27;}})();
@k4zuki02h4t4
k4zuki02h4t4 / .php
Last active May 24, 2024 03:06
Sums the values of two associative arrays with the same keys. 同じキーを持つ 2 つの連想配列の値を合計します。
<?php
/**
* Sums the values of two associative arrays with the same keys.
*
* This function takes two associative arrays with identical keys and
* returns a new array where each value is the sum of the corresponding
* values from the input arrays.
*
* @param array $array1 The first associative array.
* @param array $array2 The second associative array.
@k4zuki02h4t4
k4zuki02h4t4 / app.gs
Last active May 10, 2024 16:21
From backlog to chatwork.
/**
* 文字列の末尾からスラッシュを削除する
*
* @param {string} str
* @returns {string}
*/
function delete_trailing_slash(str) {
if (str.slice(-1) === '/') {
str = str.slice(0,-1);
}
@k4zuki02h4t4
k4zuki02h4t4 / .sql
Created August 23, 2019 15:14
重複するデータを削除する SQL。出典 https://chaika.hatenablog.com/entry/2019/02/21/120000
DELETE FROM
table_a
WHERE id NOT IN (
SELECT
id
FROM(
SELECT
*
FROM
table_a AS t1
@k4zuki02h4t4
k4zuki02h4t4 / .sh
Last active September 9, 2019 18:11
コマンドメモ
php artisan config:cache
php composer.phar dump-autoload
php artisan db:seed --class=prefacture --force
php artisan migrate:fresh --seed
git stash
git flow init
git stash list
git branch
git stash show stash@{0}
<?php
define( 'PAGESPEED_INSIGTHS_ENDPOINT', 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed?' );
define( 'PAGESPEED_INSIGTHS_LOCALE', 'ja' );
define( 'PAGESPEED_INSIGTHS_API_KEY', 'your_api_key' );
$score = 0;
/**
* @see https://developers.google.com/speed/docs/insights/v5/reference/pagespeedapi/runpagespeed
*/
$parameter = array(
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
[Unit]
Description=H2O - the optimized HTTP/1, HTTP/2 server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
ExecStart=/usr/sbin/h2o -m master -c /etc/h2o/h2o.conf
ExecReload=/bin/kill -HUP ${MAINPID}
ExecStop=/bin/kill -TERM ${MAINPID}
PrivateTmp=true
@k4zuki02h4t4
k4zuki02h4t4 / functions.php
Created June 22, 2018 07:55
[PHP] GD または Imagick で画像をリサイズする
<?php
/**
* 内接サイズを計算する
*
* @see https://qiita.com/suin/items/b01eebc05209dba0eb3e
*
* @param int $width
* @param int $height
* @param int $containerWidth
* @param int $containerHeight