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
// シンプルなスライドショー | |
// photo-main メイン画像コンテナ | |
// photo-thumb サムネイルコンテナ | |
$('#photo-thumb a').click(function() { | |
$('#photo-main img').hide(); | |
var path = $(this).attr('href'); | |
var img = new Image(); | |
img.src = path; | |
// 画像をスムーズに切り替えるために一度removeしてからappendする。 | |
$('#photo-main img').remove(); |
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
// クロージャーは呼び出し元が関数の変数名解決の環境を保持する。 | |
// そのためクロージャーは呼び出し元から参照できる必要がある。 | |
// 参照の可能性がないものはガーベージコレクションされる。 | |
// クロージャーではない単なる関数 | |
// 呼び出し元に何も帰らないので | |
// hogeを抜けた時点で変数var, incはガーベージコレクションされる | |
function hoge() { | |
var count = 0; | |
function inc() { |
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
<h3>外部ブログ表示</h3> | |
<?php // Get RSS Feed(s) | |
include_once(ABSPATH . WPINC . '/rss.php'); | |
$rss = fetch_rss('フィードのパス'); | |
$maxitems = 5; | |
$items = array_slice($rss->items, 0, $maxitems); | |
?> | |
<ul> | |
<?php if (empty($items)) : ?> | |
<li>投稿はありません。</li> |
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 getOffset(inner, outer) { | |
// オフセット | |
var offsetX = Math.ceil(($(outer).width() - $(inner).width()) / 2); | |
var offsetY = Math.ceil(($(outer).height - $(inner).height()) / 2); | |
var offset = { | |
x: offsetX, | |
y: offsetY | |
}; | |
return offset; | |
} |
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 | |
$value = htmlspecialchars($_GET["test"]); | |
header("Content-Type: text/html; charset=UTF-8"); | |
echo $value; | |
?> |
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
/* | |
Copyright (c) Copyright (c) 2010-2011, Christian Johansen | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | |
Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. |
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
/** | |
* | |
* layout element to center for targettarget | |
* | |
* @param {jQuery} target optional | |
* @param {String} type optional vertical, horizonal, all | |
* @return jQuery Object | |
*/ | |
jQuery.fn.setCenter = function(target, type) { | |
target = target || $(window); |
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
<html> | |
<body> | |
<p id="foo"></p> | |
</body> | |
</html> |
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
<html> | |
<body> | |
<p><button id="foo">Click</button></p> | |
</body> | |
</html> |
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
/** | |
* Custom function can pass arguments(string, number, object, array, function) to a function. | |
*/ | |
/** | |
* 参考サイト | |
* WIZARD-CODE ウィザード・コードのブログ | WIZ-CODE.blog | |
* http://wiz-code.digick.jp/blog/?p=711 | |
*/ | |
function customTimeout() { |
OlderNewer