Loading...
よく使うコードの断片を、用途ごとにまとめておく。コピーしてすぐ使えるよう、短い説明を添える。
JavaScript で配列の重複をなくす。Set を使うのが手軽。
const unique = [...new Set(items)];タイムゾーンのずれを避けたいときに使う。
const ymd = new Date().toLocaleDateString("sv-SE");非同期処理のテストやリトライの間隔に使う。
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
await sleep(1000);中身が空かどうかを調べる。
const isEmpty = (obj) => Object.keys(obj).length === 0;Python でフォルダ内のファイルを取り出す。
from pathlib import Path
files = [p.name for p in Path("./data").glob("*.csv")]
Comments
No comments yet
Be the first to comment