Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 472

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 487

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 494

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 530

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-includes/cache.php on line 103

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-includes/theme.php on line 623

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/custom_posts/custom_posts.php on line 22

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 46

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 67

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 75

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 92

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiRender.php on line 70

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 181

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 538

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 695

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 1087

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112
おれせか

おれせか

なんかそれっぽいのをうにうに。

macのterminalでワンライナー

対象の文をコピって

pbpaste | ruby -ne 'puts "#{$..to_s}\t#{$_}"' | pbcopy

rubyのオプションの-pと-nの差忘れないようにめも from:Rubyの起動

-n
このフラグがセットされるとプログラム全体が sed -nやawk のように

while gets

end

で囲まれているように動作します.

-p
-nフラグとほぼ同じですが, 各ループの最後に変数 $_ の値を出力するようになります。
例:

% echo matz | ruby -p -e ‘$_.tr! "a-z", "A-Z"’
MATZ

PAGETOP

Terminalでnkf使うとはやいね。

半角カナを全角カナへ

echo 'ウンコ' | nkf -W

出力結果

ウンコ

全角カナを半角カナへ

Z4オプションで変換できるみたい。

echo 'ウンコ' | nkf -W -Z4

出力結果

ウンコ

ちょこっと変換したいだけなのにechoとかめんどくさいです><

macだとコピーとペーストのコマンドがそれぞれ『pbcopy』と『pbpaste』なので、
変換したい文字列をコピーして、

pbpaste | nkf -W | pbcopy

そして、おもむろに貼りつけ。

やったー! できたよー!

PAGETOP

paginate

Categories: cakephp, php

ここの存在すら忘れてた。
たまにmemoがわりに使ってこう。

/name/action/1?type=f

みたいに適当にgetでパラメータ渡してるとこでのページング。

よく忘れるので書いとく。

そのままだとページ送りしたらパラメータ消えるので
controller側で

$this->passedArgs['type'] = 'f'; 

みたいにして、view側では

if(isset($this->passedArgs)) $paginator->options(array('url' => $this->passedArgs)); 

てかんじのも忘れずに。

#ひさびさすぎてここに書く記法わすれとるし。

PAGETOP

Search