Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryu Yamashita yamaryu0508

  • Kintone Corporation
  • San Francisco
View GitHub Profile
@yamaryu0508
yamaryu0508 / exec_curl.js
Created Nov 19, 2017
cURLコマンドを実行するLambda関数
View exec_curl.js
const exec = require('child_process').exec;
exports.handler = (event, context, callback) => {
// TODO implement
//callback(null, 'Hello from Lambda');
let cmd = 'curl -X GET "https://subdomain.cybozu.com/k/v1/records.json?app=308" -H "X-Cybozu-API-Token: xxxx"';
cmd = event.cmd || process.env.cmd || cmd;
exec(cmd, (err, stdout, stderr) => {
if (err) {
console.log(err);
@yamaryu0508
yamaryu0508 / kintone-prevent-xss-sample-1.js
Last active Nov 22, 2017
テンプレートエンジンを用いた「フィールドのラベルにスクリプトが仕込まれる(kintone-xss-sample-1.js)」への対策
View kintone-prevent-xss-sample-1.js
/*
* global.$
* global._
*/
jQuery.noConflict();
(function ($) {
'use strict';
kintone.events.on(['app.record.index.show'], function (event) {
@yamaryu0508
yamaryu0508 / kintone-xss-sample-3.js
Last active Nov 15, 2017
カスタマイズで足したテキストボックスにスクリプトが入力される
View kintone-xss-sample-3.js
/*
* global.$
*/
jQuery.noConflict();
(function ($) {
'use strict';
kintone.events.on(['app.record.index.show'], function (event) {
// 値をヘッダにappendするテキストボックス生成
@yamaryu0508
yamaryu0508 / kintone-xss-sample-2.js
Last active Nov 15, 2017
レコードのフィールドの値にスクリプトが仕込まれる
View kintone-xss-sample-2.js
/*
* global.$
*/
jQuery.noConflict();
(function ($) {
'use strict';
kintone.events.on(['app.record.index.show'], function (event) {
// レコードのフィールド値からセレクトボックス生成
@yamaryu0508
yamaryu0508 / kintone-xss-sample-1.js
Last active Nov 15, 2017
フィールドのラベルにスクリプトが仕込まれる
View kintone-xss-sample-1.js
/*
* global.$
*/
jQuery.noConflict();
(function ($) {
'use strict';
kintone.events.on(['app.record.index.show'], function (event) {
// フィールド情報からセレクトボックスを生成
@yamaryu0508
yamaryu0508 / async-xhr-get-records.js
Last active Nov 14, 2017
非同期XHRによるレコード取得APIのリクエスト
View async-xhr-get-records.js
var url = kintone.api.url('/k/v1/records', true) + '?app=' + kintone.app.getId();
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.onload = function () {
if (xhr.status === 200) {
// success
console.log(JSON.parse(xhr.responseText));
} else {
@yamaryu0508
yamaryu0508 / javascript.json
Last active Jun 8, 2017
kintone JavaScript API VSCode用スニペット
View javascript.json
{
/*
// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
View kintoneBalusSnippet.js
function runBalus(intent, session, callback) {
console.log('start "run Balus"');
var cardTitle = intent.name;
var favoriteColorSlot = intent.slots.Color;
var repromptText = "Run Balus. I'll delete all kintone records.";
var sessionAttributes = {};
var shouldEndSession = true;
var speechOutput = "Run Balus. I'll delete all kintone records.";
View Raspberry PiのCPU温度をAWS IoTにパブリッシュするサンプル
var awsIot = require('aws-iot-device-sdk'); // AWS IoT SDK
var moment = require('moment'); // Date library // moment
var exec = require('child_process').exec;
// constant parameters
const DEVICE_NAME = 'dev1';
const TOPIC = "raspi/temp"; // MQTT TOPIC
const REGION = 'ap-northeast-1';
// device config.
View customize_default.json
{
"app": 19,
"scope": "ALL",
"desktop": {
"js": [{
"type": "URL",
"url": "https://js.cybozu.com/jquery/1.11.3/jquery.min.js"
}, {
"type": "URL",
"url": "https://js.cybozu.com/jqueryui/1.11.4/jquery-ui.min.js"