Skip to content

Instantly share code, notes, and snippets.

View ka215's full-sized avatar

ka2 ka215

View GitHub Profile
@ka215
ka215 / table_relation_fields.php
Last active August 29, 2016 09:49
CDBT: How to display the input fields (select list, combobox) that is related the column of foreign tables by using filter hook.
<?php
function my_shortcode_custom_forms( $elements_options, $shortcode_name, $table ){
if ( 'master_data' === $table ) {
global $cdbt;
$cities = $cdbt->get_data( 'cities' );
$_city_list = [];
$jobs = $cdbt->get_data( 'jobs' );
$_job_list = [];
foreach ( $elements_options as $_i => $_option ) {
$_default_value = $elements_options[$_i]['defaultValue'];
@ka215
ka215 / fn.date.js
Last active June 10, 2023 08:50
The function datetime formatter for JavaScript like date function of PHP
/**
* JavaScript datetime formatter like date() of PHP
* ------------------------
* Version: 1.0.0
* Coded by: Ka2 (https://ka2.org/)
* Lisenced: MIT
*/
function date( format, date ) {
// Date format like PHP
var baseDt = Object.prototype.toString.call( date ) === '[object Date]' ? date : new Date( date ),
@ka215
ka215 / wp-emergency.php
Created June 16, 2017 14:39
This is the tool for WordPress to manually deactivate any plugins and rollback to default theme.
<?php
/**
* WordPress Emergency Tools v1.0
*
* This is a tool to manually deactivate a theme and any plugins when you can not
* access the admin panel due to WordPress theme or plugins bug etc.
* Usage it please place this file in the same directory as "wp-config.php" and
* access it directly from the browser.
* Please delete this file promptly after use (If this file will remain, it will
* be a serious security hole for your service).
@ka215
ka215 / demo2.php
Created March 23, 2021 08:26
jQuery.Timeline Demo as early type of scheduler type
<?php
// Const
define( 'USE_LOCAL_TIMEZONE', true );
// Local Valiables
try {
// Get now datetime by using DateTimeImmutable Object
$timezone = USE_LOCAL_TIMEZONE ? date_default_timezone_get() : 'UTC';
// $timezone = 'Asia/Tokyo';
// $timezone = 'Europe/London';
@ka215
ka215 / demo-mcuh.php
Created March 23, 2021 08:29
MARVEL Cinematic Universe History as demo of jQuery.Timeline
<?php
// Const
define( 'USE_LOCAL_TIMEZONE', true );
// Local Valiables
try {
// Get now datetime by using DateTimeImmutable Object
$timezone = USE_LOCAL_TIMEZONE ? date_default_timezone_get() : 'UTC';
// $timezone = 'Asia/Tokyo';
// $timezone = 'Europe/London';
@ka215
ka215 / sample3.html
Created March 23, 2021 08:38
jQuery.Timeline demo source of "https://ka2.org/jqtl-v2/v2.1.html"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery.Timeline Sample - 3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/ka215/jquery.timeline@master/dist/jquery.timeline.min.css" -->
<link rel="stylesheet" href="../dist/jquery.timeline.min.css?210">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<style>
@ka215
ka215 / sample-crud.html
Created March 31, 2021 10:56
Source Codes of jQuery.Timeline CRUD System Sample
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery.Timeline Sample - CRUD System</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/ka215/jquery.timeline@main/dist/jquery.timeline.min.css">
<link rel="stylesheet" href="./dist/jqtl-crud.css?1">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
</head>
@ka215
ka215 / gist:c0d3245c2b35d8fbfdbe49a57de050aa
Created April 7, 2021 09:11
How to pseudo-appear dynamically row-height on the jQuery.Timeline
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery.Timeline Views</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/gh/ka215/jquery.timeline@main/dist/jquery.timeline.min.css" rel="stylesheet">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<style>
.main-content,
@ka215
ka215 / gist:d5ddfb8c78aadb1439c1a9b1875a32e5
Created April 10, 2021 08:28
Database Table Scheme For MHRise Skill Simulator
CREATE TABLE `weapons` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '武器ID',
`name` varchar(255) NOT NULL COMMENT '武器名',
`type` tinyint(4) unsigned NOT NULL COMMENT '武器種',
`tree` varchar(255) NOT NULL COMMENT '派生名',
`rarity` tinyint(4) unsigned NOT NULL COMMENT 'レア度',
`rank` tinyint(4) unsigned NOT NULL COMMENT 'ランク',
`attack` int(11) unsigned NOT NULL COMMENT '攻撃力',
`sharpness` json DEFAULT NULL COMMENT '切れ味',
`affinity` tinyint(4) NOT NULL COMMENT '会心率',
@ka215
ka215 / gist:478ef44ba94d0ffe7ea7cafcbf48a3c0
Created May 14, 2021 02:33
MHRise Skill Simulator Database Tables v1.0.1: Create Table Queries
CREATE TABLE `weapons` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '武器ID',
`name` varchar(255) NOT NULL COMMENT '武器名',
`ruby_name` varchar(255) NOT NULL COMMENT '武器名ルビ',
`type` tinyint(4) unsigned NOT NULL COMMENT '武器種',
`tree` varchar(255) NOT NULL COMMENT '派生名',
`rarity` tinyint(4) unsigned NOT NULL COMMENT 'レア度',
`rank` tinyint(4) unsigned NOT NULL COMMENT 'ランク',
`attack` int(11) unsigned NOT NULL COMMENT '攻撃力',
`affinity` tinyint(4) NOT NULL COMMENT '会心率',