This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 入力タイプの切替イベント。 | |
$func = ' | |
function changeType() { | |
var type = parseInt($("#SurveyQuestionType").val()); | |
if(type <= 3){ | |
$(".question_item").show("normal"); | |
} else { | |
$(".question_item").hide("fast"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$str = " \t \n \r \0 \x0B "; | |
var_dump(trim($str, " \t\n\r\0\x0B ")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
array_walk_recursive( | |
$data, | |
create_function( | |
'&$val, $key', | |
'if(in_array($key, array("id", "created", "modified"))) $val = null;') | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$kana = array( | |
'アイウエオ', | |
'カキクケコ', | |
'サシスセソ', | |
'タチツテト', | |
'ナニヌネノ', | |
'ハヒフヘホ', | |
'マミムメモ', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 所属カテゴリ内で、同じタグを持つコンテンツを取得。 | |
$this->Content->Behaviors->attach('Matchable'); | |
$options = array( | |
'jointo' => array( | |
'Tag' => array('type' => 'INNER'), | |
), | |
'conditions' => array( | |
'Tag.id' => Set::extract('/Tag/id', $content), | |
'Content.category_id' => Set::extract('/Category/id', $categories), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 文字列から | |
$timestamp = strtotime('2012-03-01 15:47:00'); | |
// タイムスタンプから | |
$yyyymmdd = date("Y/m/d", $timestamp); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"---------------------------------------------------- | |
" toggle.vim | |
" Bundle 'taku-o/vim-toggle' | |
"---------------------------------------------------- | |
let g:toggle_pairs = { | |
\ 'and' : 'or', | |
\ 'or' : 'and', | |
\ 'if' : 'elseif', | |
\ 'elseif' : 'else', | |
\ 'else' : 'if', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"---------------------------------------------------- | |
" QFixHowm | |
" Bundle 'fuenor/qfixhowm' | |
"---------------------------------------------------- | |
let howm_dir = $HOME . '/howm' | |
let howm_fileencoding = 'utf-8' | |
let howm_fileformat = 'unix' | |
let QfixHown_UserSwActionLock = ['[]', '[cakephp]', '[vim]', '[linux]'] | |
nnoremap <silent> g,. :<C-u>call HatenaSuperPreHighlight()<CR> | |
"Hatena super pre highlight |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$this->SurveyResponse->virtualFields['count'] = 0; | |
$data = $this->SurveyResponse->find( | |
'all', | |
array( | |
'fields' => array( | |
'SurveyResponse.response_value', | |
'count(id) as "SurveyResponse__count"', | |
), | |
'conditions' => array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:replace(...) range "{{{ | |
if a:0 < 2 | |
return | |
endif | |
let range = a:firstline . ',' . a:lastline | |
let tmp = @@ | |
silent exec range . 'yank' | |
let text = @@ |