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
#ただ、既に大量のファイルが登録されている場合、これをひとつひとつやっていたら大変なので、以下のように git ls-files の -i と --exclude-from オプションを使って、まとめて除外するとらくです。 | |
git rm --cached `git ls-files --full-name -i --exclude-from=.gitignore` | |
#-i は --ignored の略で、Git に登録されているファイルの内、次に指定する方法で無視するファイルの一覧を出力します。 | |
#--exclude-from=<ignore-file> を指定すると、<ignore-file> に記述されたパターンにマッチするファイルを、無視するファイルとして扱います。 | |
#--exclude-standard を指定すると、Git が標準で無視リストとして扱う .gitignore や .git/info/exclude などのファイルに書かれたパターンにマッチするファイルを、無視するファイルとして扱います。 |
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
# 1. Streamっぽく | |
spawn = require('child_process').spawn | |
spawn 'cmd', ['arg1','arg2'], ['-op1','-op2'] | |
spawn.stdout.on 'data', (data) -> | |
# todo | |
# 2. Callbackっぽく | |
exec = require('child_process').exec | |
exec 'cmd arg arg -op1 -op2', (err, stdout, stderr) -> | |
# todo |
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 datetime import date | |
from calendar import monthrange | |
def get_last_date(year, month): | |
# monthrange は月の1日の曜日と日数を返してくれる | |
# 日数を date に渡せば月末の日付のできあがり | |
youbi, day = monthrange(year, month) | |
last = date(year, month, day) | |
return last |
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
import datetime | |
today = datetime.date.today() # 今日の日付けのdate型を作成 | |
# 任意の数値を変えたdateを返す | |
Year2013SameDay = today.replace(year=2013) | |
Month12SameDay = today.replace(month=12) | |
firstDay = today.replace(day=1) | |
# 0001年01月01日からの経過日数 |
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
$telnet yahoo.co.jp 80 | |
>GET / HTTP/1.0 | |
>User-Agent: Telnet [ja] (Linux) | |
>Host: www.yahoo.co.jp | |
> | |
> |
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
#git version 1.7.10.1 | |
git status | grep -e deleted | sed -e "s/# deleted: //g" | xargs git rm |
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 | |
global $wp_query; | |
$big = 999999999; // need an unlikely integer | |
echo paginate_links( array( | |
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), | |
'format' => '?paged=%#%', | |
'current' => max( 1, get_query_var('paged') ), | |
'total' => $wp_query->max_num_pages |
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
$post_time = get_the_time('U'); | |
$today = time(); |
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 | |
$big = 999999999; // need an unlikely integer | |
echo paginate_links( array( | |
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), | |
'format' => '?paged=%#%', | |
'current' => max( 1, get_query_var('paged') ), | |
'total' => $the_query->max_num_pages | |
) ); | |
?> |
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
add_theme_support( 'post-thumbnails' ); | |
add_image_size('post-index', 300, 9999); |