Skip to content

Instantly share code, notes, and snippets.

@tkc49
tkc49 / test.js
Created January 28, 2021 16:23
reduceの中でrecordの'種別'が'欠勤'じゃない時だけ取得日数を足す
(function () {
"use strict";
kintone.events.on([
'app.record.edit.submit'
], function (event) {
return new kintone.Promise(function(resolve){
RelatedRecordsFieldManager.prototype.getFieldProperties().then(function(){
(new RelatedRecordsFieldManager('取得履歴')).getRecords(event.record).then(function(records){
event.record.totalAmount2.value = records.reduce(function (sum, record) {
@tkc49
tkc49 / mocha-chai-puppeteer.js
Last active May 9, 2021 08:35
Mocha と Chai を Puppeteer を使ったテスト
// Puppeteerのインストール
// npm install puppeteer
// Mochaのインストール
// npm install mocha
// chaiのインストール
// npm install chai
const puppeteer = require('puppeteer');
@tkc49
tkc49 / mocha-chai-puppeteer.js
Created December 7, 2019 07:55
Mocha と Chai を Puppeteer を使ったテスト
// Puppeteerのインストール
// npm i puppeteer
// Mochaのインストール
// npm install mocha
// chaiのインストール
// npm install chai
const puppeteer = require('puppeteer');
(function ($) {
$(function () {
$('.wpsm_panel-body').each(function (index, element) {
// replace newline code to br tag
let replacedWpsmPanelBodyHtml = $(element).html().replace(/\r?\n/g, '<br>');
$(element).html(replacedWpsmPanelBodyHtml);
// remove <br> of first
@tkc49
tkc49 / code.html
Last active March 10, 2018 02:45
CoderDojo Japan Newsletter Code
<!-- Begin MailChimp Signup Form -->
<style type="text/css">
#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; width:100%;}<br /> /* Add your own MailChimp form style overrides in your site stylesheet or in this style block.<br /> We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */<br /></style>
<div id="mc_embed_signup"><form id="mc-embedded-subscribe-form" class="validate" action="https://coderdojo.us17.list-manage.com/subscribe/post?u=39a5824e42ab56ec44bb4e84e&amp;id=097dfa6a14" method="post" name="mc-embedded-subscribe-form" novalidate="" target="_blank">
<div id="mc_embed_signup_scroll">
<input id="mce-EMAIL" class="email" name="EMAIL" required="" type="email" value="" placeholder="メールアドレス" />
<!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input tabindex="-1" name="b_39a5824e42ab56ec44bb4e84e_0
@tkc49
tkc49 / __MAGIKCRAFT__.tkc49.magikcraft_spells.md
Last active October 8, 2017 07:03
Magikcraft Spells, by tkc49.
@tkc49
tkc49 / SassMeister-input-HTML.html
Last active September 10, 2015 01:41
Generated by SassMeister.com.
<ul class="postListBlock">
<li class="postListBlock_item">
<a href="#" class="postListBlock_item_link" title="">
<div class="postListBlock_item_link_thumbnail">
<img src="http://dummyimage.com/300x150/000/fff" alt="">
</div>
<div class="postListBlock_item_link_txt">
<time class="postListBlock_item_link_txt_time">2015/09/09</time>
<div class="postListBlock_item_link_txt_category">カテゴリー</div>
<h2 class="postListBlock_item_link_txt_title">タイトル</h2>
@tkc49
tkc49 / 0_reuse_code.js
Last active September 9, 2015 09:35
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tkc49
tkc49 / gist:08f859c675ce8ac8f463
Last active August 29, 2015 14:18
kintoneのレコード一覧画面、レコード詳細画面から他のアプリへページ遷移できるセレクトボックスメニューです。
(function(){
"use strict";
var subdomain = "";
// レコード一覧画面イベント
kintone.events.on('app.record.index.show',createAppSelectBox);
// レコード詳細画面イベント
kintone.events.on('app.record.detail.show',createAppSelectBox);
@tkc49
tkc49 / functions.php
Created November 8, 2014 02:13
RewriteAPIのサンプルソースです。 【管理画面】→【表示設定】→投稿ページ:ブログ(slug:blog)にした時に本来、URLが http://xxxx/blog となるのを http://xxxx/contents-list/reading/blog で投稿一覧を表示するサンプルです。
function myposttype_rewrite() {
global $wp_rewrite;
add_rewrite_rule(
'contents-list/reading/blog',
'index.php?pagename=blog',
'top'
);