Skip to content

Instantly share code, notes, and snippets.

View kaho2063's full-sized avatar

kanade_2go kaho2063

View GitHub Profile
@kaho2063
kaho2063 / TimeRange.php
Last active February 7, 2019 07:44
時間範囲を引いた後の合計時間を出すための時間範囲クラス(php7.2.11でのみ動作確認)
<?php
/**
* 時間範囲型(PostgreSQLのtstzrange(https://www.postgresql.jp/document/9.4/html/rangetypes.html )を参考にした)
*/
class TimeRange {
/**
* 開始時刻
* @var \DateTimeImmutable null不許可
@kaho2063
kaho2063 / userScript.js
Created October 17, 2018 00:20
Google Chromeで除外したいURLのドメインを指定することで、検索結果からDOMロード時に非表示にするユーザースクリプト(※あくまで非表示にするだけです)
"use strict";
{
/**
* 除外したいURLのドメインリスト
*/
const ExcludedURL = [
'www.excite.co.jp',
];
@kaho2063
kaho2063 / commit_push.bat
Created August 23, 2018 03:26
Gitで変更があれば実行した日時をメッセージにcommitし、そのままpushするバッチファイルです。ライセンスはNYSL(http://www.kmonos.net/nysl/ )です。
SET nowdate=%date% %time%
git add -A
for /f "usebackq" %%t IN (`git status`) DO SET HERE=%%t
if not "%HERE%"=="" (
git commit -m "・%nowdate%"
git push
)
exit
@kaho2063
kaho2063 / Bookmarklet.js
Last active January 30, 2021 09:24
カーソルの位置に日付(年/月/日 時:分)を挿入するブックマークレット。ライセンスはNYSL(http://www.kmonos.net/nysl/ )です。参考URL→http://d.hatena.ne.jp/n9d/20070606/1181133306http://www.hrykozw.com/blog/archives/551
javascript:(function(){n=(t=(document.activeElement || window.getSelection().focusNode)).selectionStart;v=t.value;s=t.scrollTop;t.value=(v.substr(0,n)+(f=[(d=new Date()).getFullYear(),(d.getMonth()+1),d.getDate()].join("/")+" "+[(d=new Date()).getHours(),d.getMinutes(),d.getSeconds()].join(":"))+v.substr(n,v.length));t.scrollTop=s;t.setSelectionRange((p=n+f.length),p)})()
@kaho2063
kaho2063 / Bookmarklet.js
Last active October 4, 2016 23:42
サムネイル付きMarkdonwリンク生成ブックマークレット サムネイル生成用に使っているサービス→http://capture.heartrails.com/ コード自体のライセンスはNYSL(http://www.kmonos.net/nysl/ )です。
javascript:(function(){prompt('Copy to Clipboard','[![]'+'(http://capture.heartrails.com/120x120/border?'+location.href+' "'+document.title.replace(/([\[\]])/g,'\\$1')+'")\n'+document.title.replace(/([\[\]])/g,'\\$1')+']'+'('+location.href+')');})();
@kaho2063
kaho2063 / index.sh
Last active November 16, 2019 05:10
このsh以下にあるMarkdownファイルのリスト一覧リンクREADME.mdを作るためのシェルスクリプト。フォルダも6階層まで対応。ライセンスはNYSL(http://www.kmonos.net/nysl/ )です。
#!/bin/bash
# README.mdというファイルに単純にechoしているため、既にREADME.mdがあった場合内容が削除される 注意
echo -e "**Index**\n\n" >README.md
# フォルダが多くなると飛ぶのが面倒なので、[TOC]追加
# TOCに対応していない場合などは考慮していない
echo -e "[TOC]\n\n---" >>README.md
# ファイルへのリンク部分を出力する関数
# $1が検索フォルダ指定