Skip to content

Instantly share code, notes, and snippets.

@potaracom
potaracom / index.js
Created April 30, 2022 09:15
kintoneのプロフィール画像変更
(() => {
const token = cybozu.data.REQUEST_TOKEN;
const downloadFile = async ({ fileKey }) => {
const res = await fetch(`/k/v1/file.json?fileKey=${fileKey}`, {
method: "GET",
headers: { "X-Requested-With": "XMLHttpRequest" },
});
return res.blob();
};
@potaracom
potaracom / icons.js
Created July 22, 2021 05:46
kintoneアプリの組み込みアイコン情報
const icons = {
APP39: "https://static.cybozu.com/contents/k/image/icon/app/appTableBlue.png",
APP62: "https://static.cybozu.com/contents/k/image/icon/app/document.png",
APP47: "https://static.cybozu.com/contents/k/image/icon/app/bargraph.png",
APP69: "https://static.cybozu.com/contents/k/image/icon/app/laptop.png",
APP61: "https://static.cybozu.com/contents/k/image/icon/app/disk.png",
APP50: "https://static.cybozu.com/contents/k/image/icon/app/calculator.png",
APP55: "https://static.cybozu.com/contents/k/image/icon/app/clipboard.png",
APP82: "https://static.cybozu.com/contents/k/image/icon/app/printer.png",
APP48: "https://static.cybozu.com/contents/k/image/icon/app/binder.png",
@potaracom
potaracom / taillog.sh
Created February 21, 2021 03:38
CloudWatch Logsのtail -f
#!/usr/bin/bash
prompt="ロググループ名を選択してください:"
options=$(aws logs describe-log-groups | jq -r ".logGroups[] | select( .logGroupName | contains(\"$1\")) | .logGroupName")
if [[ $options == "" ]]; then
echo "ロググループが存在しませんでした。"
exit 0
fi
@potaracom
potaracom / index.js
Last active December 4, 2021 23:15
添付ファイル容量の集計(開発者コンソール)
((f) => {
const script = document.createElement("script");
script.src =
"https://unpkg.com/@kintone/rest-api-client@2.0.27/umd/KintoneRestAPIClient.min.js";
script.onload = () => {
f();
};
document.body.appendChild(script);
})(async () => {
// 一覧として表示する最小容量
@potaracom
potaracom / index.js
Created December 21, 2020 11:55
グラフをダウンロード(ブックマークレット)
(async () => {
const getDatetime = () => {
const date = new Date();
const YYYY = date.getFullYear();
const MM = ("00" + (date.getMonth() + 1)).slice(-2);
const DD = ("00" + date.getDate()).slice(-2);
const HH = ("00" + date.getHours()).slice(-2);
const mm = ("00" + date.getMinutes()).slice(-2);
const ss = ("00" + date.getSeconds()).slice(-2);
@potaracom
potaracom / index.js
Last active April 13, 2021 19:57
別ドメインにファイルアップロード(kintone JavaScript API)
(() => {
const downloadFile = async ({ fileKey }) => {
const url = `/k/v1/file.json?fileKey=${fileKey}`;
const headers = { "X-Requested-With": "XMLHttpRequest" };
// ファイルダウンロードはkintone.api()では実行できない
const res = await fetch(url, { headers });
return res.arrayBuffer();
};
const stringToArrayBuffer = (string) => {
@potaracom
potaracom / index.js
Last active September 16, 2023 02:19
フィールドコードをワンクリックで表示(ブックマークレット)
((f) => {
const v = "3.7.1";
const script = document.createElement("script");
script.src = `//ajax.googleapis.com/ajax/libs/jquery/${v}/jquery.min.js`;
script.onload = () => {
const $ = jQuery.noConflict(true);
f($);
};
document.body.appendChild(script);
})(async ($) => {
@potaracom
potaracom / get.js
Last active December 16, 2020 13:57
別ドメインのレコードを取得(kintone JavaScript API)
(() => {
"use strict";
kintone.events.on(["app.record.detail.show"], async (event) => {
const domain = "xxx.cybozu.com";
const app = "xxx";
const headers = {
"X-Cybozu-API-Token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
};
const query = encodeURIComponent('会社名 = "金都運総研"');