iOSやAndroidでは、FlurryやGoogle Analyticsがユーザの行動傾向分析によく使われる。
Flurryの集計は完了するまでに1日近くかかったりする。
Parseは、リアルタイムにイベントの発生をグラフ化してくれる。
使い方はFlurryとほぼ同じ。
すぐに集計結果が見たいというせっかちな人におすすめ。
iOSやAndroidでは、FlurryやGoogle Analyticsがユーザの行動傾向分析によく使われる。
Flurryの集計は完了するまでに1日近くかかったりする。
Parseは、リアルタイムにイベントの発生をグラフ化してくれる。
使い方はFlurryとほぼ同じ。
すぐに集計結果が見たいというせっかちな人におすすめ。
アニメーションが有効な時、一部のViewの変更だけをアニメーションさせたくない場合がよくあります。
この時、いままでは以下のようなコードで実現していました:
[CATransaction begin];
[CATransaction setDisableActions:YES];
view.frame = CGRectMake(...);
[CATransaction commit];
iOS 7では、これをブロックベースで書けます:
[UIView performWithoutAnimation:^{
view.frame = CGRectMake(...);
}];
これは短くて覚えやすい。
Herokuで heroku run
などで何か変更作業した後、アプリケーションサーバを再起動させたい事がよくある。
その場合、空のcommitを行ってからpushすればいい。
% git commit --allow-empty -m "empty commit"
% git push heroku master
Leopard, Snow Leopard, Lion, Mountain Lion, Mavericksで有効。
$ dscacheutil -flushcache
You can get it on GitHub.
Cocoa/UIKit frameworks don’t load different resources on remote server based on user’s preferred language.
This class allows you to have URLs localizable.
First, you prepare multiple files for each language and their filename are like following:
A localizable URL for those files would be:
http://github.com/foo/bar/cat-{en,ja,zh}.png
As you can see above, the URL has two-letters language code(ISO 639-1) which is gonna be replaced on run-time. You include languages in the URL which resource is available. First one is used as default.
If a user prefers Japanese language, you will get URL resolved:
http://github.com/foo/bar/cat-ja.png
If a user prefers other language that is not included in the available languages, English will be used.
It can also use with XCode style file tree:
http://github.com/foo/{en,ja,zh}/cat.png
It’s same as NSURL.
NSURL* url = [NSLocalizableURL URLWithString:@"http://github.com/foo/bar/cat-{en,ja,zh}.png"];
MIT License
https://gist.github.com/noradaiko/5476125.js
It requires iostat
and bc
installed on your computer.
./check_all_iostat -w tps,read,write -c tps,read,write
-w/c TPS,READ,WRITE TPS means transfer per seconds (aka IO/s)
READ and WRITE are in KBytes per seconds
./check_all_iostat -w 200,100000,100000 -c 300,200000,200000
It will output something like:
OK - I/O stats tps=0.860000 KB_read/s=0.110000 KB_written/s=4.550000 | 'tps'=0.860000; 'KB_read/s'=0.110000; 'KB_written/s'=4.550000;
This plugin is based on check_iostat – I/O statistics. Thanks, Thiago Varela.
There is a great cookbook posted on GitHub to configure logrotation with Chef though, it may work on Ruby 1.9 or greater. My server Ruby1.8 installed couldn’t run its recipes.
I fixed a part of the cookbook so that it can also work on Ruby1.8:
https://gist.github.com/noradaiko/5219337.js
Diff is as follows:
--- a/cookbooks/logrotate/libraries/logrotate_config.rb +++ b/cookbooks/logrotate/libraries/logrotate_config.rb @@ -28,36 +28,46 @@ module CookbookLogrotate end def directives_from hash - hash.select { |k, v| DIRECTIVES.include?(k) && v }.keys + Hash[ hash.select { |k, v| DIRECTIVES.include?(k) && v } ].keys end def values_from hash - hash.select { |k| VALUES.include? k } + Hash[ hash.select { |k, v| + VALUES.include? k + } + ] end def paths_from hash - hash.select { |k| !(DIRECTIVES_AND_VALUES.include? k) }.inject({}) do | accum_paths, (path, config) | - accum_paths[path] = { - 'directives' => directives_from(config), - 'values' => values_from(config), - 'scripts' => scripts_from(config) - } + pp hash + Hash[ hash.select { |k| !(DIRECTIVES_AND_VALUES.include? k) } ].inject({}) do | accum_paths, (path, config) | + pp "----" + if config.instance_of?(Mash) + accum_paths[path] = { + 'directives' => directives_from(config), + 'values' => values_from(config), + 'scripts' => scripts_from(config) + } - accum_paths + pp accum_paths[path] + accum_paths + else + accum_paths + end end end def scripts_from hash - defined_scripts = hash.select { |k| SCRIPTS.include? k } - defined_scripts.inject({}) do | accum_scripts, (script, lines) | - if lines.respond_to? :join - accum_scripts[script] = lines.join "n" - else - accum_scripts[script] = lines - end + defined_scripts = hash.select { |k| SCRIPTS.include? k } + defined_scripts.inject({}) do | accum_scripts, (script, lines) | + if lines.respond_to? :join + accum_scripts[script] = lines.join "n" + else + accum_scripts[script] = lines + end - accum_scripts - end + accum_scripts + end end end
Hope it helps.