This file contains hidden or 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
function parseDateString(dateStr, holidays) { | |
let date; | |
if (/^\d{4}\/\d{1,2}\/\d{1,2}$/.test(dateStr)) { | |
// 日付指定の場合 | |
date = new Date(dateStr); | |
} else if (/^FY\d{2}\/\dQ$/.test(dateStr)) { | |
// 年度・四半期指定の場合 | |
const fy = parseInt(dateStr.slice(2, 4), 10); | |
const q = parseInt(dateStr.slice(-2, -1), 10); |
This file contains hidden or 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
function addBusinessDays(date, daysToAdd, holidays) { | |
// weekends: 0 = Sunday, 6 = Saturday | |
const weekendDays = [0, 6]; | |
// create a set of holidays for O(1) lookup time | |
const holidaySet = new Set(holidays.map((holiday) => holiday.getTime())); | |
let businessDaysAdded = 0; | |
let currentDate = new Date(date.getTime()); | |
while (businessDaysAdded < daysToAdd) { | |
// add one day to the current date |
This file contains hidden or 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
function getFilePathListById(fileId) { | |
var file = DriveApp.getFileById(fileId); | |
return getParentPathList(file).map(v => 'G:\\' + v + '\\' + file.getName()); | |
} | |
function iteratorToArray(iterator) { | |
var result = []; | |
while (iterator.hasNext()) { | |
result.push(iterator.next()); | |
} |
This file contains hidden or 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
/* | |
Javaのファイルを漁ってクラス構成を分析する | |
--- | |
# 実行環境 node.js | |
古いバージョンでも動くようにする。モダンな書き方はアロー式を使う程度にする | |
# 出力形式 | |
[ | |
{ | |
filePath: string, |
This file contains hidden or 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
function tableToMarkdown(table) { | |
var lines = [ | |
['カラム名', '型', 'PK', 'UNIQUE', 'NOT NULL', '備考'], | |
]; | |
lines.push(new Array(lines[0].length).fill('---')); | |
// if(table.tableNameComment.length > 0) { | |
// lines = [table.tableNameComment, ...lines]; | |
// } | |
table.columns | |
.map(v => [v.columnName, v.type, v.isPk ? '◯' : '', v.isUnique ? '◯' : '', v.isNotNull ? '◯' : '', v.comment]) |
This file contains hidden or 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
/** | |
* @param {string} text | |
* @param { {server: string, token: string} } options options.serverはたとえば"misskey.io" | |
*/ | |
function postToMisskey(text, options) { | |
return UrlFetchApp.fetch( | |
`https://${options.server}/api/notes/create`, | |
{ | |
'method': 'POST', | |
'headers' : {'Content-Type': 'application/json'}, |
This file contains hidden or 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
<!DOCTYPE html> | |
<meta charset="utf-8" /> | |
<!-- tinytestをGitHub Pagesにホスト --> | |
<script src="https://naosim.github.io/jstinytest/tinytest.js"></script> | |
<h1>test</h1> | |
<script> | |
// product code | |
function add(a, b) { |
This file contains hidden or 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
/** | |
* | |
* @param {string} markdownText | |
* @param {Date} now | |
*/ | |
function insertTodaysTitle(markdownText, now) { | |
markdownText = markdownText.trim(); | |
const firstLine = markdownText.split("\n")[0].trim(); | |
const zerofill2 = (num) => ("0" + num).slice(-2); |
This file contains hidden or 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
/* | |
Javaのファイルを漁ってクラス構成を分析する | |
--- | |
# 実行環境 node.js | |
古いバージョンでも動くようにする。モダンな書き方はアロー式を使う程度にする | |
# 使い方 | |
- ROOT_PATHを決める | |
- node analizeJava.js |
This file contains hidden or 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
(function() { | |
const obj = { | |
title: document.querySelector("h1.eventDetail-heading").innerText, | |
date: document.querySelector("time.eventAside-day").innerText, | |
time: document.querySelector("div.eventAside-time").innerText.split("\n").join(""), | |
link: location.href | |
} | |
const text = `${obj.title}\n${obj.date}${obj.time}\n${obj.link}`; | |
console.log(text); | |
prompt("リンク", text); |