Skip to content

Instantly share code, notes, and snippets.

View yamaryu0508's full-sized avatar

Ryu Yamashita yamaryu0508

  • Kintone Corporation
  • San Francisco
View GitHub Profile
@yamaryu0508
yamaryu0508 / exec_curl.js
Created November 19, 2017 06:47
cURLコマンドを実行するLambda関数
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 November 22, 2017 01:57
テンプレートエンジンを用いた「フィールドのラベルにスクリプトが仕込まれる(kintone-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 November 15, 2017 00:27
カスタマイズで足したテキストボックスにスクリプトが入力される
/*
* 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 November 15, 2017 00:27
レコードのフィールドの値にスクリプトが仕込まれる
/*
* global.$
*/
jQuery.noConflict();
(function ($) {
'use strict';
kintone.events.on(['app.record.index.show'], function (event) {
// レコードのフィールド値からセレクトボックス生成
@yamaryu0508
yamaryu0508 / kintone-xss-sample-1.js
Last active November 15, 2017 00:28
フィールドのラベルにスクリプトが仕込まれる
/*
* global.$
*/
jQuery.noConflict();
(function ($) {
'use strict';
kintone.events.on(['app.record.index.show'], function (event) {
// フィールド情報からセレクトボックスを生成
@yamaryu0508
yamaryu0508 / async-xhr-get-records.js
Last active November 14, 2017 09:54
非同期XHRによるレコード取得APIのリクエスト
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 June 8, 2017 22:14
kintone JavaScript API VSCode用スニペット
{
/*
// 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": [
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.";
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.
@yamaryu0508
yamaryu0508 / customize_default.json
Created December 13, 2015 04:57
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"