Skip to content

Instantly share code, notes, and snippets.

@ecpplus
ecpplus / sample.css
Created November 25, 2011 02:17
iOSのUIWebViewで、リンク長押し時に Copy Open というダイアログを出さないようにする
{
-webkit-touch-callout:none;
}
@ecpplus
ecpplus / sample.css
Created November 25, 2011 02:25
iOSのUIWebView(Safari)で、aタグタップ時に灰色で覆われるのを回避する
a {
-webkit-tap-highlight-color:rgba(0,0,0,0);
}
/*
* or set some color
a {
-webkit-tap-highlight-color:rgba(100,0,0,0.2);
}
*/
@ecpplus
ecpplus / gist:1399181
Created November 28, 2011 05:07
mailto の body で改行する時
%0D%0A
@ecpplus
ecpplus / gist:1422952
Created December 2, 2011 11:43
iPhone で StatusBar のスタイルを設定
// 起動時から変えておくときは、info.plist で設定する
Key: Status bar style
Type: String
Value: Opaque black style
// コードから
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
@ecpplus
ecpplus / gist:1422988
Created December 2, 2011 11:56
iPhone UIView周りのいろいろ
// 縦画面か判定
UIDeviceOrientationIsPortrait([[UIDevice currentDevice] orientation])
//
@ecpplus
ecpplus / gist:1424388
Created December 2, 2011 18:54
UITableView のヘッダのテキストを変更(任意のUIViewに変更可)
-(UIView*) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *titleWrapper = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 120, 40)] autorelease];
UILabel *titleLabel = [[[UILabel alloc] initWithFrame:CGRectMake(15, 15, 100, 20)] autorelease];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.textColor = [UIColor redColor];
titleLabel.font = [UIFont boldSystemFontOfSize:18];
switch(section) {
case 0:
titleLabel.text = @"アプリ設定";
@ecpplus
ecpplus / gist:1424457
Created December 2, 2011 19:13
UINavigationController で、バーの背景画像を設定(iOS5以降)
// グラデーションがうざいとき、単色画像とか設定すればいい
UINavigationBar *navBar = [[self navigationController] navigationBar];
UIImage *backgroundImage = [UIImage imageNamed:@"someBackgroundImage"];
[navBar setBackgroundImage:backgroundImage forBarMetrics:UIBarMetricsDefault];
// tintColor で色を指定すると、ボタン類の色が変わるので一緒に設定すること
navBar.tintColor = [UIColor redColor];
@ecpplus
ecpplus / gist:1432349
Created December 5, 2011 04:53
Apache2でmoduleを後からインストール
# apache のソースディレクトリにて
/usr/local/bin/apxs -ic modules/metadata/mod_headers.c
chmod 755 /path/to/modules/mod_headers.so
/usr/local/bin/apxs -ic modules/metadata/mod_expires.c
chmod 755 /path/to/modules/mod_expires.so
@ecpplus
ecpplus / gist:1489341
Created December 17, 2011 05:31
PHPで var_dump や print_r の出力をファイルに保存
ob_start();
print_r('$this->user_id');
var_dump($this->user_id);
$result = ob_get_contents();
ob_end_clean();
$fp = fopen("./debug.txt", "a+" );
fputs($fp, $result);
fclose( $fp );
@ecpplus
ecpplus / gist:1959881
Created March 2, 2012 17:36
Rails で bootstrap1->2に上げたときのvimの置換(form)
:%S/clearfix/control-group/gc
:%S/class="input"/class="controls"/gc
:%S/(f.label.*)\s%>/\1, :class => 'control-label' %>/gc