Skip to content

Instantly share code, notes, and snippets.

@hideki-a
hideki-a / functions.php
Last active March 18, 2021 09:29
WordPressで独自の設定項目を設定に表示する
function sitename_add_option_field() {
add_settings_field(
'sitename_home_news_posts_count',
'ホームページ新着表示数',
function () {
$setting = get_option( 'sitename_home_news_posts_count' ) ?: 4;
echo '<input name="sitename_home_news_posts_count" id="sitename_home_news_posts_count" type="number" min="3" max="8" step="1" value="'. esc_attr( $setting ) . '" class="small-text">';
},
'reading',
'default',
@hideki-a
hideki-a / lawyer.js
Created June 8, 2020 11:16
タブの例
console.log('UserJsCSSプラグインのlawyer.jsを読み込みました。');
const userJsCss = {};
userJsCss.vars = {
nTabs: 0
};
userJsCss.makeTabs = function (tabs) {
let counter = 0;
let tabMenuItemHTML = '';
let tabPanelsQuery = [];
{
"name": "research-axe-core",
"version": "1.0.0",
"description": "",
"main": "run-axe.js",
"scripts": {
"start": "node run-axe.js > report.csv && nkf -s --overwrite report.csv"
},
"author": "Hideki Abe",
"dependencies": {
@hideki-a
hideki-a / relation_load.php
Created September 21, 2019 21:27
リレーションのロード
<?php
$terms = ['rev_type' => 0, 'status' => 4];
$join_stmt = ['name' => 'categories', 'from_obj' => 'entry', 'to_id' => 1];
$args = ['join' => ['relation', ['entry_id', 'from_id'], $join_stmt ] ];
$entries = $db->model('entry')->load( $terms, $args );
<?php
$mt_dir = '/path/to/pcms/';
require_once ( $mt_dir . 'php/mt.php' );
require_once ( $mt_dir . 'addons/DynamicMTML.pack/php/dynamicmtml.php' );
$blog_id = 1;
$mt_config = $mt_dir . 'mt-config.cgi';
$app = new DynamicMTML();
$app->configure( $mt_config );
try {
@hideki-a
hideki-a / LinkEntry.pm
Last active June 11, 2018 04:41
記事番号から記事を表示
package MT::App::LinkEntry;
use strict;
use base qw( MT::App );
use MT::Entry;
# See Also: http://www.ark-web.jp/sandbox/wiki/306.html
@MT::App::LinkEntry = qw( MT::App );
sub init {
@hideki-a
hideki-a / app.js
Last active May 2, 2017 23:03
Forked from takanashi66/vue_rest.
'use strict';
Vue.component('search-form', {
props: {
query: String,
},
template: `
<form class="search" action="#" @submit.prevent="searchPosts">
<input type="search" :value="query"><input type="submit" value="検索">
@hideki-a
hideki-a / cocoapods.command
Last active January 19, 2017 04:45
ワンクリックでCocoapodsのインストールから依存ライブラリのインストールまでを行う
#!/bin/sh
gem which cocoapods 2> /private/tmp/result_which_cocoapods
result=$(</private/tmp/result_which_cocoapods)
if echo "$result" | grep -q "Can't"; then
echo 'Cocoapods not installed.'
echo 'Install Cocoapods.'
echo '"Password"の表示が出たら、ログインのパスワードを入力してください。'
sudo gem install cocoapods
@hideki-a
hideki-a / blog.html
Last active November 19, 2017 01:12
ブログ記事srcset設定例
<!-- 横 -->
<img src="/assets/20171119_pic_01.jpg" alt="写真:JIS X 8341-3:2016, WCAG 2.0, ISO/IEC 40500:2012 早見表" srcset="/assets/20171119_pic_01.jpg 720w, /assets/20171119_pic_01_1440w.jpg 1440w" sizes="(min-width: 740px) 720px, 100vw">
<!-- 縦 -->
<img src="/assets/20161227_pic_01.jpg" alt="24日1回目のステージの光景" srcset="/assets/20161227_pic_01.jpg 480w, /assets/20161227_pic_01_750w.jpg 750w, /assets/20161227_pic_01_960w.jpg 960w" sizes="(min-width: 500px) 480px, 100vw">
@hideki-a
hideki-a / AppDelegate.swift
Created November 25, 2016 00:22
Swift 2.3用のAppDelegate.swift
//
// AppDelegate.swift
// [AppName]
//
// Created by [Your Name] on [201x/xx/xx].
// Copyright © 201x年 [Your Name]. All rights reserved.
//
import UIKit