Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View fumikito's full-sized avatar
🐕
Have 1 dog. Her name is Packing.

Takahashi Fumiki fumikito

🐕
Have 1 dog. Her name is Packing.
View GitHub Profile
@fumikito
fumikito / wpdb−test.php
Created December 8, 2014 16:32
wpdb道場第一回目
<?php
// これでWordPress関数がほとんど使えるようになる!
include 'wp-load.php';
// オプションを10件取得
$options = $wpdb->get_results("SELECT * FROM {$wpdb->options} LIMIT 10");
// 公開済み投稿の本文の長さを全部足す
$query = <<<SQL
SELECT SUM(CHAR_LENGTH(post_content))
@fumikito
fumikito / wp-cli-table-display.php
Created May 13, 2015 10:01
Show table on WP_CLI
<?php
$table = new \cli\Table();
$table->setHeaders( $header );
$table->setRows( $body );
$table->display();
@fumikito
fumikito / gist:f401882937243564bdb1
Created June 17, 2015 12:15
ePubの目次サンプル
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" class="blog logged-in epub-toc rtl"
xmlns:epub="http://www.idpf.org/2007/ops">
<head>
<meta charset="UTF-8"/>
<title> 目次</title>
<meta name="viewport" content="width=device-width"/>
<link rel="stylesheet" href="../Asset/wp-content/themes/hametuha/assets/css/epub.css" type="text/css"/>
</head>
@fumikito
fumikito / git_diff
Last active September 1, 2015 05:02
Archive files between 2 commits on Git repository
#!/usr/bin/env php
<?php
if( isset( $argv[1] ) && preg_match('/(-{1,2})?help$/', $argv[1] ) ) {
echo <<<'TXT'
/**
* Archive git diff file between specified commit
*
* git_diff ./archive 29879823c HEAD
*
* Enter above, diff between HEAD and 29879823c will be arvhived to `./archive`.
@fumikito
fumikito / wp-enqueue-assets.php
Created August 23, 2010 10:04
Sample of loading assets in WordPress
<?php
/*
* @pakage WordPress
* This file resolve external js and css loading and their chaching.
* Put this file in your theme foloer and
* write the line below in your theme's "functions.php"
*
* require_once(TEMPLATEPATH."/wp-assets.php");
*
*/
@fumikito
fumikito / mootools-fade.js
Created September 13, 2010 05:52
Extend MooTools' fade in & out.
/**
* Code snipet for fade in & out with MooTools.
* @author Takahashi Fumiki
* @description
*/
Element.prototype.fadeIn = function(display){
if(display == undefined)
display = "block";
var fx = new Fx.Morph(this);
@fumikito
fumikito / justification.html
Created September 14, 2010 16:29
Justification with Webkit
<!DOCTYPE html>
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width , user-scalable=no , inicial-scale=1 , maximum-scale=1" />
<title>問わずがたりの洋酒外史</title>
<style>
body{
font-family:"HiraKakuProN-W3", serif;
font-size:12px;
@fumikito
fumikito / ruby-ios.css
Created September 16, 2010 07:10
Imitate <ruby> tag
/**
* Style sheet for rendering <ruby> properly.
*
* @source
*/
ruby{
overflow:hidden;
display:inline-table;
line-height:inherit;
vertical-align:text-bottom;
@fumikito
fumikito / mac-epub.bash
Created October 2, 2010 12:59
Mac OS XでePubファイルを固めるときのコマンド
zip -X0 ../sample.epub mimetype
zip -rDX9 ../sample.epub * -x "*.DS_Store" -x mimetype
@fumikito
fumikito / intel-injector.php
Created October 16, 2010 14:42
HTMLのpタグにインテルを挿入する
<?php
/**
* XMLの特定のタグにインテルを挿入する
*
* インテルとは活版印刷で用いられる活字間の隙間を挿入する金属のことです。
* Webkitエンジンなど、CSSのtext-justifyプロパティに対応していないブラウザは
* テキストのジャスティフィケーションを半角スペースのサイズ調整で行います。
* 日本語は分かち書きをしないため、半角スペースでのサイズ調整が適用されません。
* このクラスでは指定されたタグの直下にあるすべてのテキストのノードに対して
* 空白を含むspanタグを挿入します。