Skip to content

Instantly share code, notes, and snippets.

View kwbtdisk's full-sized avatar
😆
Am exciting building Application in JS/TS

Daisuke Kawabata kwbtdisk

😆
Am exciting building Application in JS/TS
View GitHub Profile
@kwbtdisk
kwbtdisk / gist:f0eac0927eabfa9865c69d2fd87c3cd1
Created February 9, 2017 12:23
Mautic on kusanagi nginx.conf
#=======================================
# mautic on kusanagi
#---------------------------------------
server {
listen 80;
server_name mautic.xxx.site ;
access_log /home/kusanagi/provision_name/log/nginx/access.log main;
error_log /home/kusanagi/provision_name/log/nginx/error.log warn;
@kwbtdisk
kwbtdisk / change_commit_time.sh
Created November 26, 2017 09:05
Change git commit time and author time
#!/usr/bin/env bash
usage() {
echo "Script for rewrite commit time"
echo 'Usage: ./gitignore_change_commit_time.sh --num 1 --time "$(date -v-46H)"'
echo " --num [NUM] ex: 3"
echo " --time [DATETIME] ex: 'Fri Nov 24 16:00:00 2017'"
exit 1
}
for OPT in "$@"
@kwbtdisk
kwbtdisk / in_your_functions.php
Last active October 20, 2020 02:24
[WordPress] Integration with Ajax Search Lite & Bogo (Adjust the seach query for the page's language)
// Adjust the seach query of Ajax Search Lite with Bogo
add_action('asl_query_add_args', 'ajax_search_light_and_bogo_integration', 100, 1);
function ajax_search_light_and_bogo_integration( $args ) {
global $wpdb;
// Bogo saves the page language into the cookie, so we can just pick it.
$loc = $_COOKIE['lang'];
if(!$loc) { return $args; }
$args['where'] .= <<<SQL
AND ID IN ((
@kwbtdisk
kwbtdisk / dl_from_gdrive.sh
Created April 8, 2019 02:45
Download a large file on google drive with curl on linux
FILE_ID="xxxxxxxxxxxxxxxxxxxx"
curl -sc /tmp/cookie "https://drive.google.com/uc?export=download&id=${FILE_ID}" > /dev/null
CODE="$(awk '/_warning_/ {print $NF}' /tmp/cookie)"
curl -Lb /tmp/cookie "https://drive.google.com/uc?export=download&confirm=${CODE}&id=${FILE_ID}" -o archive.zip
@kwbtdisk
kwbtdisk / utils-for-elementor.css
Last active April 23, 2019 04:48
Utility CSS for Elementor
/* Display */
.d-inline-block { display:inline-block !important; }
.d-block { display:block !important; }
.d-inline { display:inline !important; }
.d-block { display:block !important; }
/* Float */
.float-left { float:left; }
.float-right { float:right; }
/* Full-width button */
.button-block .elementor-button { display:block !important; }
@kwbtdisk
kwbtdisk / modelDefinitions.otherColAttributes.js
Created October 31, 2021 02:38
CORE Framework 他のカラムの入力値に応じて、カラムの表示/非表示を切り替える (`enableIf: (row) => boolean` 関数を利用する)
// Model定義 のカラムの "JS形式の追加カラム定義" へ追記
{
enableIf: (row) => {
// 経費申請Modelで "金額が5000円以上のときにのみ" imageカラムを表示させる
// console.log(row)
// debugger
return row.amount >= 5000
}
}
@kwbtdisk
kwbtdisk / modelDefinitions.otherColAttributes.js
Last active April 15, 2022 03:07
CORE Framework 選択肢マスタ を活用する: ダイナミック多段選択肢を実現する https://youtu.be/U9ItZbuJMHg
/**
* ## 選択肢マスタ を活用する: ダイナミック多段選択肢を実現する
* - [ ] "勘定科目" カラムを作成: 通信費, 旅費交通費, 広告宣伝費, 接待交際費, 消耗品費
* - "種別" カラムの選択肢を "勘定科目" で選択された値に応じて表示する
* - 例: 勘定科目が "旅費交通費" の場合に、 "通勤" "出張交通費" "客先移動交通費"
* - カラム定義の Javascriptにて、
* - dynamicSelections: true
* - async selections() {...(ココでダイナミックにしたい) }
* - [x] 選択肢マスタを作成
* - グループ名: "旅費交通費:種別"
@kwbtdisk
kwbtdisk / modelDefinitions.otherColAttributes.js
Last active October 31, 2021 08:15
CORE Framework editCallback の使い方 https://youtu.be/U9ItZbuJMHg
/**
* ## editCallback の使い方
* - 例: "勘定科目" を選択して、値が変更されているなら、 "種別" をクリアする
* - "勘定科目" (accoutingType) のeditCallback関数を追加する
*/
{
editCallback: ({row, newValue, oldValue}) => {
console.log({row, newValue, oldValue})
// row: 現在編集しているデータ
// row.accoutingType
@kwbtdisk
kwbtdisk / modelDefinitions.otherColAttributes.js
Last active October 31, 2021 08:16
CORE Framework バリデーションルールを設定 https://youtu.be/MRVKIw-qtAs #COREFramework
/**
* ## カラム バリデーションルールを設定:
* - 定義済みバリデーション
* - 入力必須 notEmpty: boolean (UI上で設定可能)
* - 最小値 min: number (UI上で設定可能)
* - 最大値 max: number (UI上で設定可能)
* - 数値 isInt: boolean
* - isFloat: boolean
* - isEmail: boolean
* - カスタムバリデーション
@kwbtdisk
kwbtdisk / modelDefinitions.otherColAttributes.js
Last active November 1, 2021 01:22
https://youtu.be/XVo5bcTLHYI CORE リレーションカラムの選択値を活用して他のフィールドを更新する リレーションシップ + editCallback
/**
* "データタイプ" で M2Oリレーションシップ を選択し、
* リレーションデータのラベル表示 (Label formatter) 欄へ下記を入力
**/
return row.name + ` (¥${row.price})`
/**
* JS形式の追加カラム定義 (otherColAttributes) へ設定
*
* ## CORE リレーションカラムの選択値を活用して他のフィールドを更新する (リレーションシップ + editCallback)