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
class JsonTable { | |
constructor(data = {}, isSafetyMode = true) { | |
this.data = data; | |
this.isSafetyMode = isSafetyMode; | |
} | |
insert(id, obj) { | |
if(this.data[id]) { | |
throw new Error(`IDがすでに存在する: ${id}`); | |
} | |
this.data[id] = this.copyIfNeeded(obj) |
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
class LocalFileJsonRepository { | |
constructor(fileHandle = null) { | |
this.fileHandle = fileHandle; | |
} | |
async init() { | |
if(this.fileHandle) { | |
return; | |
} | |
[this.fileHandle] = await window.showOpenFilePicker(); | |
} |
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
/** | |
* 内部でUrlFetchAppを使っています | |
*/ | |
class ChatWorkClient { | |
constructor(token) { | |
this.token = token; | |
this.baseUrl = 'https://api.chatwork.com/v2'; | |
this.header = { 'X-ChatWorkToken' : token }; | |
} | |
postMessage(roomId, message) { |
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
import org.assertj.core.api.exception.RuntimeIOException; | |
import org.springframework.beans.factory.config.BeanDefinition; | |
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; | |
import org.springframework.core.type.filter.RegexPatternTypeFilter; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RestController; | |
import java.io.File; | |
import java.io.IOException; | |
import java.lang.reflect.Method; |
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
import * as board2d from 'https://raw.githubusercontent.com/naosim/deno-board2d/v1.2.0/src/mod.ts'; | |
export { | |
Board, | |
BoardMutable, | |
Pos, | |
Direction, | |
X, | |
Y | |
} from 'https://raw.githubusercontent.com/naosim/deno-board2d/v1.2.0/src/mod.ts'; |
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" /> | |
<script> | |
/** | |
* 1次元オセロの盤面に白の石を置く | |
* | |
* - 盤は配列で表現する | |
* - 白の石は'白' | |
* - 黒の石は'黒' | |
* - 空の場所はnull |
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> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/frappe-gantt/0.3.0/frappe-gantt.min.css"></link> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/snap.svg/0.5.1/snap.svg-min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/frappe-gantt/0.3.0/frappe-gantt.min.js"></script> | |
<svg id="gantt"></svg> | |
<script> |
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
/** | |
* スプレッドシートの2次元配列をエンティティの配列に変換する | |
* - 2次元配列は0番目はヘッダー(カラム名の配列)行、1番目以降にデータが並んでいること | |
* - ヘッダー行のカラム名は空でないこと | |
* - カラム名は値の最初の行だけ採用される 例: "身長\n[cm]" → カラム名は"身長"になる | |
* @param {[['name', 'age'], ['mike', 30]]} ary2d - スプレッドシートのような2次元配列 | |
* @return 例: [{name:"mike", age:30}, {name:"jiro", age:40}] | |
*/ | |
function toEntities(ary2d) { | |
var headers = ary2d[0] |
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 comDate(dates, typesCsv) { | |
var convert = function(d, type) { | |
if(type == '年月') { | |
return d.getYear() + ('0' + (d.getMonth() + 1)).slice(-2); | |
} | |
var nendo = 'FY' + (d.getMonth() + 1 < 4 ? d.getYear() - 1: d.getYear()); | |
if(type == '年度') { | |
return nendo; | |
} | |
if(type == '半期') { |
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
/** | |
* メールを検索する | |
* 注意: 内部でGmailApp.searchを利用しているため、検索結果は多めに取れる。厳密にするには戻り値に対してもう一度フィルターをかける必要がある。 | |
* | |
* @param {string} searchText | |
* @param {object} option 省略可 | |
* @return {GmailMessage[]} 日付の昇順でソート済み | |
*/ | |
function searchMail(searchText, option) { | |
// optionの初期値セットアップ |