Skip to content

Instantly share code, notes, and snippets.

View miya0001's full-sized avatar

Takayuki Miyauchi miya0001

View GitHub Profile
@miya0001
miya0001 / gist:2037109
Created March 14, 2012 15:09
WordPressで好き勝手なコンテンツを好き勝手なURLで表示する
<?php
/*
Plugin Name: I am Free!
Author: My Name
Description: WordPressで好き勝手なコンテンツを好き勝手なURLで表示する。
*/
require_once(dirname(__FILE__).'/includes/class-addrewriterules.php');
require_once(dirname(__FILE__).'/includes/class-addpage.php');
!#/usr/bin/env bash
set -ex
echo $1
@miya0001
miya0001 / jpegoptim.php
Created March 20, 2018 19:33
Optimizing images for WordPress with the jpegoptim
<?php
add_filter( 'wp_image_editors', function( $editors ) {
if ( ! class_exists( '_WP_Image_Editor_GD' ) ) {
class _WP_Image_Editor_GD extends WP_Image_Editor_GD {
protected function _save( $image, $filename = null, $mime_type = null ) {
$saved = parent::_save( $image, $filename, $mime_type );
if ( ! empty( $saved["mime-type"] ) && 'image/jpeg' == $saved["mime-type"] ) {
jpegoptim( $saved['path'] );
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@miya0001
miya0001 / style.json
Last active March 20, 2020 05:05
GSI Japan + OSM
{
"version": 8,
"name": "Geolonia Basic",
"sources": {
"gsi-japan": {
"type": "vector",
"tiles": [
"https://cyberjapandata.gsi.go.jp/xyz/experimental_bvmap/{z}/{x}/{y}.pbf"
],
"attribution": "<a href=\"https://www.gsi.go.jp/\">GSI Japan</a>",
{
"version": 8,
"name": "Geolonia Basic",
"metadata": {},
"sources": {
"geolonia": {
"type": "vector",
"url": "https://api.geolonia.com/v1/sources?key=YOUR-API-KEY"
},
"japanese-prefectures": {
{
"version": 8,
"name": "Geolonia Basic",
"sources": {
"geolonia": {
"type": "vector",
"url": "https://api.geolonia.com/v1/sources?key=YOUR-API-KEY"
},
"japanese-prefectures": {
"type": "geojson",
{
"version": 8,
"name": "Geolonia Midnight",
"metadata": {},
"sources": {
"geolonia": {
"type": "vector",
"url": "https://api.geolonia.com/v1/sources?key=YOUR-API-KEY"
}
},
<?php
/**
* Plugin Name: _tarosky
* Plugin URI: https://tarosky.co.jp/
* Description: Fixes the some problems with our environment.
* Author: Takayuki Miyauchi
* Version: nightly
*
* @package _tarosky
*/
@miya0001
miya0001 / cli.md
Created February 22, 2020 12:28
WP-CLI
$ git clone https://github.com/wp-cli/extension-command.git
$ cd extension-command
$ composer install

このあと、このリポジトリのコマンドを実行するには、このディレクトリ内にいたまま WP-CLI コマンドを実行するといいです。

$ wp help theme --path=/path/to/wordpress