Skip to content

Instantly share code, notes, and snippets.

@yokotak0527
yokotak0527 / gist:5166676
Last active December 14, 2015 23:38
orig_concat動かす為にexecを使うのはなんか違う気がする。後で調べる
'use strict';
module.exports = function(grunt){
var config = grunt.config,
exec = require('child_process').exec,
say = 'say -v kyoko ';
var jsDir = 'sample/build/'; // jsのディレクトリ
var jsDestDir = 'sample/';
@yokotak0527
yokotak0527 / gist:5151272
Created March 13, 2013 11:32
ゆっくり喋らせる
'use strict';
// =============================================================================
// 変更点
// =============================================================================
// '<config:prop.subprop>' → '<%= prop.subprop %>'
// '<json:file.json>' → grunt.file.readJSON('file.json')
// '<file_template:file.js>' → grunt.template.process(grunt.file.read('file.js'))
module.exports = function(grunt){
// =============================================================================
// 参照:https://npmjs.org/doc/json.html
// =============================================================================
{
// -------------------------------------------------------------------------
// name : プロジェクト名 [必須]
// -------------------------------------------------------------------------
"name":"v0.4",
// -------------------------------------------------------------------------
@yokotak0527
yokotak0527 / gist:4759796
Created February 12, 2013 02:39
WordPress ページング
function paging($query_arr){
global $total_page_num;
global $paged;
$range = 5;
$half = 0;
$range_offset = 0;
$page_offset = 0;
$cnt = '<nav class="paging"><ul>';
// prev
if($paged != 1){
@yokotak0527
yokotak0527 / gist:4719739
Last active December 12, 2015 05:08
WordPressで投稿をカスタム投稿に移動させるときのテンプレ
<?php
// WordPress post moves to custom post.
// 参考 -> http://techblog.55w.jp/?p=224
$posts = get_posts(array(
'post_type'=>'post',
'numberposts'=>500
));
// カテゴリーからカスタムタクソノミーに移動させるときに利用
// keyがカテゴリー名でvalがターム名
// key is category name,val is term name.
@yokotak0527
yokotak0527 / gist:4671567
Last active December 11, 2015 22:39
PHP で無いクエリを取ってこようとするとエラーが返るので、issetでセットされているかNULLではないかをチェックして処理を変える。
$home = isset($_GET['home']) ? $_GET['home'] : NULL;
@yokotak0527
yokotak0527 / hyoka130102.jpg
Last active December 10, 2015 12:49
illustration practice
hyoka130102.jpg
@yokotak0527
yokotak0527 / gist:4346916
Created December 20, 2012 17:21
yeoman Gruntfileにgrunt-growl足したやつ
module.exports = function( grunt ) {
'use strict';
//
// Grunt configuration:
//
// https://github.com/cowboy/grunt/blob/master/docs/getting_started.md
//
grunt.initConfig({
// ------------------------------------
@yokotak0527
yokotak0527 / welcart priceArr
Created July 27, 2012 03:07
welcart 価格の配列を返すやつ
// 使い方は
// $arr = priceArr(usces_the_firstPrice('return'));
// みたいな感じ。
// 返り値は配列。
// 管理画面で税率は必ず指定しておくこと!
function priceArr($price=0){
global $usces;
$pos = $usces->options;
@yokotak0527
yokotak0527 / welcart $wcmbで分岐
Created July 19, 2012 01:15
welcart 拡張プラグイン WCEX MobileのオブジェクトでPC、スマホ、ガラケーの分岐
// welcart 拡張プラグイン WCEX Mobile
// http://www.welcart.com/archives/1626.html
// $wcmbのプロパティで環境ごとの分岐ができそうだったのでメモ
// ガラケーかどうかの判定っぽい。返り値はintかboolian
// PCで0:int スマホで10:int ガラケーでtrue:bool
$wcmb['check_garak']
// デバイスの名前が入ってる
// PCだとPC:string スマホ、ガラケーだと機種名