This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# UUID=1234-37bd-4098-9f8b-85e99c9c5219 /boot xfs defaults 0 0 | |
blkid | grep $1 | sed -r 's#^.*UUID="([a-Z0-9\-]+)".*TYPE="([a-Z0-9\-]+)".*$#UUID=\1\t'$2'\t\2\tdefaults\t0\t0#' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Provides a block to display 'Site branding' elements. | |
* | |
* @Block( | |
* id = "system_branding_block", | |
* admin_label = @Translation("Site branding") | |
* ) | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"php": ">=5.4", | |
"johnpbloch/wordpress": "4.7.5" | |
}, | |
"extra": { | |
"wordpress-install-dir": "public/wp" | |
}, | |
"post-install-cmd": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Smart Custom Fieldsの定義用クラス | |
* グループごとにメソッドを作ると良い | |
* | |
* @link https://2inc.org/blog/2015/03/12/4670/ | |
*/ | |
Class Test_SmartCustomFields { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ $# -lt 3 ]; then | |
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]" | |
exit 1 | |
fi | |
DB_NAME=$1 | |
DB_USER=$2 | |
DB_PASS=$3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://codex.wordpress.org/Transients_API | |
// kショートコードをsキャッシうュるコード | |
add_shortcode('someshortcode', function() { | |
echo 'hoge'; | |
}); | |
add_shortcode('someshortcode_cached', function() { | |
if ( $ret = get_transient('someshortcode') ) { | |
return $ret; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! class_exists( 'RecommendPost' ) ) { | |
class RecommendPost { | |
static function init() { | |
add_action( 'admin_menu', array( __CLASS__, 'add_meta_box' ) ); | |
add_action( 'save_post', array( __CLASS__, 'save_meta_data' ) ); | |
add_action( 'pre_get_posts', array( __CLASS__, 'change_order' ) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# @see http://qiita.com/miya0001/items/4dc5949dd792963ef578 Thanks! | |
# Usage: ssh user@example.com | |
# Automatically adds `-i user@example.com` argument for `ssh` command. | |
# test: bash -c 'source ssh_bash.bash; ssh user@example.com ls' | |
function ssh { | |
local HOSTSTR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# -ne 1 ]; then | |
echo "warn: need a url" | |
exit 1 | |
fi | |
#正体はただのaliasでした! | |
wget --no-host-directories -r -np $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 年度が始まる日 | |
define('ANNUAL_START_DAY', '04-02'); | |
/** | |
* 「年度」を取得する | |
* | |
*/ | |
function get_annual_year(DateTime $date) { |