Skip to content

Instantly share code, notes, and snippets.

@marushu
marushu / gist:4199444
Created December 4, 2012 00:42 — forked from lucasfais/gist:1207002
ST2 Keybord Short Cuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@marushu
marushu / category_list.php
Last active December 20, 2015 06:39
カテゴリ一覧用ショートコード
<?php
function category_list( $atts ) {
extract( shortcode_atts( array(
'post_type' => 'post',
'cat_name' => '',
'num' => 3,
'class' => 'relational_lists',
'orderby' => 'date',
), $atts ) );
@marushu
marushu / akan_cat_list.php
Last active December 20, 2015 06:39
これはアカンヤツ。 returnが無い方ね (^^)
<?php function category_list( $atts ) {
extract( shortcode_atts( array(
'post_type' => 'post',
'cat_name' => '',
'num' => 3,
'class' => 'relational_lists',
'order' => 'date',
), $atts ) );
global $post;
@marushu
marushu / no_overlap_posts.php
Last active December 31, 2015 16:29
get_postsでランダム取得で最初の2投稿とその他を分ける
<?php // https://gist.github.com/marushu/8013747 ← my gists
$args = array(
'post_type' => get_post_type(),
'numberposts' => -1,
'orderby' => 'rand'
);
$no_overlap_posts = get_posts( $args );
setup_postdata( $post );
//$test_array[] = $no_overlap_posts;
@marushu
marushu / copyright.php
Created January 6, 2014 06:00
Copyright
@marushu
marushu / import_data_use_sessionstorage.js
Last active August 29, 2015 13:56
イベントデータをロード。 データのポップアップを非表示(閉じるをクリックしたら) ・イベントの終了時間 ・イベントid をsessionStorageに格納。 それぞれのイベントが終わって、 かつ非表示設定になっているイベントデータの情報をクリアする。
var nagasa = $(".each_creature_event li.live").size();
var storage = sessionStorage;
var storageLength = storage.length;
var arr = new Array();
var checkarr = new Array();
var date = new Date();
var unixTimestamp = Math.round( date.getTime() / 1000 );
var pageAttribute = $("html").attr("lang");
@marushu
marushu / content.php
Last active August 29, 2015 13:56
ACF(Advanced Custom Fields)プラグインを使って、館内イベントのデータを取得、直近のイベント10分前からイベントを出力させる
<section id="data_inner">
<?php
// 緊急のお知らせ用カウンタ
$boxcounter = 0;
// サイトの「今日」の日付を取得
$local_timestamp = current_time( 'timestamp' ); // ローカルのタイムスタンプ
$now = gmdate( 'H', $local_timestamp ); // ローカルの時刻文字列
//echo "nowを出力" . $now; // 現在時刻の「時」を出力
<?php
define('CRON_SCHEDULE_HANDLER', 'load_oricon_entry_38');
// wp-cron で実行させたい処理
function cron_schedule_handler() {
load_oricon();
// 指定時間後に再度起動
$time_interval = 5 * 60; // 5 * 60 : 5分おき
wp_schedule_single_event( time() + $time_interval, CRON_SCHEDULE_HANDLER );
<?php
// user role display test
global $wp_roles;
$all_roles = $wp_roles->roles;
echo "<pre>";
print_r( $wp_roles );
echo "</pre>";
ditable_roles = apply_filters('editable_roles', $all_roles);
echo "<pre>";
print_r( $editable_roles );
# Copyright (C) 2014
# This file is distributed under the same license as the package.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: http://wordpress.org/tag/login-lockdown\n"
"POT-Creation-Date: 2014-05-17 05:44:39+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"