Skip to content

Instantly share code, notes, and snippets.

View ki6ool's full-sized avatar

ki6ool ki6ool

View GitHub Profile
@ki6ool
ki6ool / https.html
Last active May 25, 2016 07:54
javascriptでクロスドメインを越えてcolorboxつかう
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.colorbox/1.6.4/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="https://raw.githubusercontent.com/padolsey-archive/jquery.fn/master/cross-domain-ajax/jquery.xdomainajax.js"></script>
<script>
$(function() {
$.ajax({
type: 'GET',
url: 'http://target.com/',
dataType: 'html',
success: function(data) {
$.colorbox({html:data.responseText, width:'80%', height:'80%'});
@ki6ool
ki6ool / functions.php
Created May 23, 2016 04:51
Wordpressでメンテナンス画面に任意のテンプレートを表示させる
<?php
add_action('init', 'quick_maintenance_mode');
function quick_maintenance_mode() {
include_once 'maintenance.php';
die;
}
@ki6ool
ki6ool / linebot_helper.php
Created May 17, 2016 05:21
LINE BOT APIの簡易ヘルパー
<?php
/**
* LINE BOT API Helper For Wordpress
* @link https://developers.line.me/bot-api/api-reference
* @author ki6ool
*/
class LB_CONSTANT {
const END_POINT = 'https://trialbot-api.line.me';
const TO_CHANNEL = '1383378250';
@ki6ool
ki6ool / gist:dee60706e7f65150d82211647bc14e31
Created April 22, 2016 06:25
CSR証明書作成手順(SHA256)
$ openssl genrsa -out #name#.key 2048
$ openssl req -new -sha256 -key #name#.key -out #name#.csr
# 証明書
上:証明書
下:中間証明書
@ki6ool
ki6ool / line_bot.php
Last active April 21, 2016 06:09
PHPでLINE BOT動かすサンプル
<?php
class LINE_BOT {
private $end_point = 'https://trialbot-api.line.me';
private $channel_id = '***';
private $channel_secret = '***';
private $mid = '***';
private $event_type = '138311608800106203';
private $to_channel = '1383378250';
private $result;
private $content;
@ki6ool
ki6ool / zundokokiyoshi.php
Created March 24, 2016 08:53
例のズンドコキヨシに参加してみた。
<?php
class ZundokoKiyoshi {
private $ZUNDOKO = ['ズン', 'ドコ'];
private $PHRASE = '';
function __construct() {
do {
$step = array_map(array($this, 'section'), range(0, 4));
} while ('00001' != implode('', $step));
printf('%s<strong>%s</strong>', $this->PHRASE, 'キ・ヨ・シ!');
@ki6ool
ki6ool / gist:2cb74c40ae6bb509971f
Created March 15, 2016 05:08
UIkitのModalを中央寄せに
<!--
リンクから表示の場合は下記の公式通り
<a href="#my-id" data-uk-modal="{center:true}"></a>
-->
<script>
var $modal = UIkit.modal(".modalSelector", {center: true});
</script>
@ki6ool
ki6ool / functions.php
Created February 10, 2016 14:21
[wordpress]カスタムフィードを追加する
<?php
/**
* @link https://codex.wordpress.org/Rewrite_API/add_feed
* @link https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
*/
add_action('init', function() {
/*
* 投稿条件を変更する場合は pre_get_posts をフック
* 設定後パーマリンクの更新
*/
@ki6ool
ki6ool / gist:c1940b60432a3df3b27f
Created February 1, 2016 09:23
[Wodpress]各投稿タイプ最新1件を取得する
<?php
/**
* @link http://betterwp.net/latest-posts-from-each-post-type/
*/
global $wpdb;
$query = <<<EOT
SELECT * FROM
(
SELECT post_type, max(post_date) AS tmp FROM {$wpdb->posts}
WHERE post_status = 'publish'
@ki6ool
ki6ool / functions.php
Last active January 29, 2016 08:22
投稿編集画面タイトル下に投稿IDを表示させる
<?php
/**
* @link https://wpdocs.osdn.jp/プラグイン_API/アクションフック一覧
* edit_form_after_title
* WordPress 投稿編集画面 (およびカスタム投稿タイプ) のタイトルの後、かつ、ビルトインの WordPress コンテンツ領域の前で実行する。
*/
add_action('edit_form_after_title', function () {
global $post;
echo "<p>ID: <b>{$post->ID}</b></p>";
});