This file contains 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
# | |
# The default server | |
# | |
server { | |
listen 80; | |
server_name _; | |
root /var/www/html; | |
index index.html index.htm index.php; | |
charset utf-8; |
This file contains 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 | |
add_filter('nginxchampuru_get_cache', 'nginxchampuru_get_cache', 10, 2); | |
function nginxchampuru_get_cache($key, $url = null) { | |
global $nginxchampuru; | |
if (!$url) { | |
$url = $nginxchampuru->get_the_url(); | |
} | |
$keys = array( | |
$key, | |
$nginxchampuru->get_cache_key($url.'@ktai'), |
This file contains 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 | |
function dec_to_n( $dec, $n = 62, $disits = null ) { | |
if ( !$disits ) { | |
$disits = array( | |
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', | |
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', | |
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', | |
'u', 'v', 'w', 'x', 'y', 'z', | |
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', | |
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', |
This file contains 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 | |
function get_tweet_lines($userName){ | |
date_default_timezone_set('Asia/Tokyo'); | |
$rssUrl = 'http://twitter.com/statuses/user_timeline/'.$userName.'.rss'; | |
// get cache | |
if ( ($response = get_transient(md5($rssUrl))) === false ) { | |
$response = wp_remote_get($rssUrl); | |
if( !is_wp_error( $response ) && $response["response"]["code"] === 200 ) { | |
set_transient(md5($rssUrl), $response, 60 * 60 ); // 60sec * 60min = 1hour |
This file contains 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 | |
/** | |
* Create the post footer | |
* | |
* Override: childtheme_override_postfooter <br> | |
* Filter: thematic_postfooter | |
*/ | |
function childtheme_override_postfooter() { | |
$post_type = get_post_type(); |
This file contains 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 | |
/* | |
Plugin Name: Just do it ! | |
Plugin URI: | |
Description: | |
Version: 0.1 | |
Author: | |
Author URI: | |
*/ | |
new just_do_it(); |
This file contains 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 | |
function custom_search($search, $wp_query) { | |
global $wpdb; | |
//サーチページ以外だったら終了 | |
if (!$wp_query->is_search) | |
return $search; | |
if (!isset($wp_query->query_vars)) | |
return $search; |
This file contains 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 | |
if ( isset($_GET['url']) ) { | |
$url = stripslashes($_GET['url']); | |
NginxCachePurge::purge($url); | |
} | |
Class NginxCachePurge { | |
const CACHE_LEVELS = '1:2'; | |
const CACHE_DIR = '/var/cache/nginx/proxy_cache'; |
This file contains 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
ec2-api-tools を Mac にインストール | |
wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip | |
unzip ec2-api-tools.zip | |
mkdir ~/ec2 | |
mv ec2-api-tools-1.6.1.4//bin/ ~/ec2/ | |
mv ec2-api-tools-1.6.1.4//lib/ ~/ec2/ | |
export EC2_HOME=~/ec2 | |
export PATH=$PATH:$EC2_HOME/bin |
OlderNewer