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
# http://torquemag.io/preparing-wordpress-site-power-single-page-web-app/ | |
add_filter( 'json_serve_request', function( ) { | |
$domains = array( 'http://torquemag.io', 'http://wordpress.org' ); | |
if( isset( $_SERVER['HTTP_ORIGIN'] && in_array( $_SERVER['HTTP_ORIGIN'], $domain ) ) ) { | |
$domain = $_SERVER['HTTP_ORIGIN']; | |
header( "Access-Control-Allow-Origin: {$domain}" ); | |
} |
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
var fetch = http.request({ | |
host: "stackoverflow.com", | |
port: 80, | |
path: "/", | |
method: "GET", | |
withCredentials: false // this is the important part | |
}, function(res) { | |
var result = "" | |
res.on('data', function(chunk) { | |
result += chunk; |
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
from google.appengine.api import urlfetch | |
from urllib import urlencode | |
url = 'http://search.hatena.ne.jp/keyword’ | |
params = {'mode' : 'rss', | |
'ie' : 'utf-8', | |
'word' : 'python', | |
'page' : 1} | |
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
http://d.hatena.ne.jp/sasaplus1/20120318/1332060348 |
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
http://qiita.com/bsdhack/items/597eb7daee4a8b3276ba |
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
# HOGE="pwd"として | |
echo "$HOGE" | |
#>> pwd | |
# 変数展開する | |
echo '$HOGE' | |
#>> $HOGE |
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
# ${} で変数展開する際に置換する? | |
# | |
# echo "${VAR/SEARCH/REPLACE}" | |
HOGE="abcdef" | |
echo $HOGE | |
#>> abcdef | |
echo "${HOGE/abc/xyz}" |
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
http://blog.frd.mn/install-nginx-php-fpm-mysql-and-phpmyadmin-on-os-x-mavericks-using-homebrew/ |
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
# プライベートメンバ変数にアクセス。 | |
# インスタンス._クラス名__変数名でアクセスできる。(推奨されない) | |
print w._Widget__secret |
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
# user date() method | |
datetime.datetime.now().date() |