Skip to content

Instantly share code, notes, and snippets.

@hideki-a
hideki-a / functions.php
Last active Mar 18, 2021
WordPressで独自の設定項目を設定に表示する
View functions.php
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',
View lawyer.js
console.log('UserJsCSSプラグインのlawyer.jsを読み込みました。');
const userJsCss = {};
userJsCss.vars = {
nTabs: 0
};
userJsCss.makeTabs = function (tabs) {
let counter = 0;
let tabMenuItemHTML = '';
let tabPanelsQuery = [];
View package.json
{
"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 Sep 21, 2019
リレーションのロード
View relation_load.php
<?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 );
View zipsearch.php
<?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 Jun 11, 2018
記事番号から記事を表示
View LinkEntry.pm
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
Forked from takanashi66/vue_rest.
View app.js
'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 Jan 19, 2017
ワンクリックでCocoapodsのインストールから依存ライブラリのインストールまでを行う
View cocoapods.command
#!/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 Nov 19, 2017
ブログ記事srcset設定例
View blog.html
<!-- 横 -->
<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 Nov 25, 2016
Swift 2.3用のAppDelegate.swift
View AppDelegate.swift
//
// AppDelegate.swift
// [AppName]
//
// Created by [Your Name] on [201x/xx/xx].
// Copyright © 201x年 [Your Name]. All rights reserved.
//
import UIKit