Skip to content

Instantly share code, notes, and snippets.

View s-hiroshi's full-sized avatar

Hiroshi Sawai s-hiroshi

View GitHub Profile
@s-hiroshi
s-hiroshi / example.php
Created July 9, 2012 05:17
WordPress > plugin > template
<?php
/*
Plugin Name: Example
Version: 1.0
Plugin URI: http://www.example.com
Description: Wordpress plugin template
Author: Example
Author URI: http://www.example.com
*/
@s-hiroshi
s-hiroshi / comment.js
Created July 10, 2012 08:13
JavaScript > comment template
/**
* example
* http://www.example.com
*
* Copyright (c) 2012 "Example corp" My name
* Licensed under example license.
*/
/* global object is Example */
@s-hiroshi
s-hiroshi / utils.js
Created July 11, 2012 00:35
jQuery > utility halfway
jQuery(function ($) {
// 拡張用の名前空間
var Util = {};
// jQueryの拡張
jQuery.extend({'util': Util});
// 静的メソッドの追加
Util.hoge = function () {
};
// その他の処理
@s-hiroshi
s-hiroshi / wp-loop-foreach.php
Last active February 25, 2017 07:12
Wordpress - スニペット - foreach文を使用した基本ループのサンプルです。
/**
* foreachを使ったサンプル
*
* reffer
* get_posts
* http://codex.wordpress.org/Template_Tags/get_posts
*/
<?php
$args = array(
'posts_per_page' => 5,
@s-hiroshi
s-hiroshi / childlist.php
Created July 11, 2012 14:02
WordPress > snippet > get child category id
<?php
if (is_category('example') || in_category('example')) {
if (!is_front_page()) {
$cat = get_category_by_slug('example');
$cat_id = intval($cat->cat_ID);
$url = get_category_link($cat_id);
$name = $cat->name;
?>
<h2><a href="<?php echo esc_url($url); ?>"><?php echo esc_html($name); ?></a></h2>
<ul>
@s-hiroshi
s-hiroshi / style.css
Created July 12, 2012 04:51
CSS > yui font size
/**
font size
10 77
11 85
12 93 (was 93)
13 100
14 108 (was 107)
15 116 (was 114)
16 123.1 (was 122)
17 131 (was 129)
@s-hiroshi
s-hiroshi / category.php
Created July 18, 2012 07:13
WordPress > snippets > category
<?php
* アイキャッチ付きアーカイブページの雛型
* ■ 詳細ページへのリンク処理
* Moreタグ
* 有 - Moreタグの前までを表示
* - リンク「詳細はこちら」のリンクを表示
* - 見出し(h2)にパーマリンクを設定
* 無 - 全文を表示
* - リンク「詳細はこちら」のリンクは非表示
* - 見出し(h2)にパーマリンクを設定しない。
@s-hiroshi
s-hiroshi / taglist.html
Created August 14, 2012 08:44
html tag list
html
body
address
a:link
a:visited
a:hover
a:active
@s-hiroshi
s-hiroshi / README.md
Created August 17, 2012 14:00
JavaScript > create script tag dynamic. order of execution.

動的に読み込むスクリプトの実行順序

関数で動的にスクリプトを読み込んだときのスクリプトの実行順序の確認用。

@s-hiroshi
s-hiroshi / index.html
Created August 18, 2012 02:15
JavaScript > json padding simple sample
<!DOCTYPE HTML>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>JSON Padding</title>
<script>
function doJSONP(text, callback) {
var text = (text) || 'Foo',
callback = (callback) || 'callback',
target = document.createElement('script');