DRYな備忘録

Don't Repeat Yourself.

2014-08-23から1日間の記事一覧

【iptables】公開したくないport番号にファイアーウォールを設定する

ゴール アプリケーションが9090番ポートで動いている nginxの設定でsample.com:80をlocalhost:9090にリバースプロキシしている しかし9090番が外部公開なのでsample.com:9090でもアクセスできてしまう この9090番ポートを外部的には閉じたい 9090番ポートの…

【iOS】Timestamp to NSDate Object

Goal Get NSDate instance from timestamp-like NSInteger Solution Use dateWithTimeIntervalSince1970 method of NSDate NSDate *d = [NSDate dateWithTimeIntervalSince1970:timestamp]; DRY

【iOS】NSDictionaryからlongを取り出す

ゴール 以下のようなNSDictionaryから"Timestamp"をlongとして値を取り出したい // *dict { Number = 1408756029; Message = "hogeee"; } 解決 NSDictionaryのobjectForKeyを使ってから、longLongValueでキャストする long num = [[dict objectForKey:@"Fini…