Skip to content

Instantly share code, notes, and snippets.

View narita1980's full-sized avatar
🎯
Focusing

narita1980 narita1980

🎯
Focusing
View GitHub Profile
@narita1980
narita1980 / gist:3102783
Created July 13, 2012 04:50
特定サイズのデータファイルを作成する方法
$ dd if=/dev/zero of=tmpfile1 bs=1024 count=90000
@narita1980
narita1980 / index.html
Created September 19, 2012 00:49
HTML5で作る「シンプルメモ帳」 (全8回) - ドットインストール
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charaset="UTF-8">
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<title>メモ帳</title>
</head>
<body>
<h1>メモ帳</h1>
<textarea id="memo" rows="10" cols="40" name="memo"></textarea>
@narita1980
narita1980 / index.html
Created September 19, 2012 05:14
localStorageを使った一行掲示板
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<title>一行掲示板</title>
</head>
<body>
<h1>一行掲示板</h1>
<form action="" method="post">
$ ls -l | cut -f 5 -d" "
60974881
59324524
55605231
51894156
48293723
44810780
41347986
37894218
34493241
@narita1980
narita1980 / functions.php
Last active December 14, 2015 17:48
[未検証][WordPress]カテゴリーページのみ表示するショートコード ■使用例 [show_category_page]囲まれている箇所がカテゴリページのみ表示されます[/show_category_page] ■参考サイト -関数リファレンス/is category - WordPress Codex 日本語版- http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/is_category
function show_category_page( $atts, $content = null ) {
if ( is_category() ) {
return $content
}
}
add_shortcode('show_category_page', 'show_category_page);
@narita1980
narita1980 / exec_java.php
Created March 9, 2013 15:58
PHPからjavaを実行するサンプル
<?php
putenv('CLASSPATH=/opt/・・・'); //CLASSPATHを通す必要がある時は設定する
$arg= 'parameter1'; //引数の入力例
$ret = exec("java sample $arg");
echo $ret;
?>
@narita1980
narita1980 / exp_imgtag.php
Created March 12, 2013 08:06
HTMLファイル内のimgタグを抽出する ■使用例 $ php exp_imgtag.php < sample.html <img alt="・・・・ /> <img border="・・・ /> ・・・
<?php
$stdin = file_get_contents('php://stdin', 'rb');
preg_match_all('@<img .*?/>@isu' ,$stdin ,$regex, PREG_SET_ORDER);
foreach ($regex as $str) {
echo $str[0] . PHP_EOL;
}
?>
@narita1980
narita1980 / gist:5149985
Created March 13, 2013 07:29
proxy経由でfile_get_contentsを利用する方法 [参考サイト] http://www.php.net/manual/ja/function.file-get-contents.php#58758
<?php
$proxy = array(
'http' => array(
'proxy' => 'tcp://127.0.0.1:8080',
'request_fulluri' => True,
),
);
$context = stream_context_create($proxy);
@narita1980
narita1980 / gist:5150001
Last active December 14, 2015 21:19
file_get_contentsでproxy設定が必要なときのエラーメッセージ
Warning: file_get_contents(http://xxx.co.jp/xxx.jpg):
failed to open stream: operation failed in /xxxx.php on line 66
Warning: strtotime(): It is not safe to rely on the system's timezone settings.
You are *required* to use the date.timezone setting or the date_default_timezone_set() function.
In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.
We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.
in /xxxx.php on line 52