This file contains hidden or 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
[self.navigationController setNavigationBarHidden:YES animated:YES]; |
This file contains hidden or 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
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath]; | |
CGSize size = [cell.textLabel.text sizeWithFont:cell.textLabel.font constrainedToSize:tableView.frame.size lineBreakMode:UILineBreakModeWordWrap]; | |
return size.height; | |
} |
This file contains hidden or 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
//sortNSMutableArray(array, attr); | |
static inline NSMutableArray *sortNSMutableArray(NSMutableArray *ar, NSString *attr) { | |
NSSortDescriptor *dateAsc = [[[NSSortDescriptor alloc] initWithKey:attr ascending:NO] autorelease]; | |
NSMutableArray *descriptors = [NSArray arrayWithObjects:dateAsc, nil]; | |
[ar sortUsingDescriptors:descriptors]; | |
return ar; | |
} | |
This file contains hidden or 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
= link_to "xxx", "#", :class => ["active"] | |
= link_to "xxx", "#", {:class => "active"} |
This file contains hidden or 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
//NSDateを渡して現在の時間との時間差を求める | |
//getTiming(date); | |
static inline NSString* getTiming(NSDate *date) { | |
NSDateFormatter *dateFormatter = [NSDateFormatter new]; | |
[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"ja_JP"]]; | |
[dateFormatter setDateFormat:@"yyyy/MM/dd HH:mm:ss"]; | |
NSString *sdate = [dateFormatter stringFromDate:date]; | |
NSDate *now = [NSDate dateWithTimeIntervalSinceNow:[[NSTimeZone systemTimeZone] secondsFromGMT]]; | |
NSTimeInterval since = [now timeIntervalSinceDate:date]; | |
int day = since/(24*60*60); |
This file contains hidden or 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
NSMutableDictionary *dic = @{ | |
@"xxx":xxx, | |
@"xxxx":xxxx | |
}.mutableCopy; | |
//or | |
NSMutableDictionary *dic = @{}.mutableCopy; | |
dic[@"xxx"] = @"xxx"; | |
dic[@"xxxx"] = @"xxxx"; |
This file contains hidden or 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
NSMutableArray *ar = @[ | |
@"xxx", | |
@"xxxx" | |
].mutableCopy; | |
NSMutableArray *ar = @[].mutableCopy; | |
ar[0] = @"xxx"; | |
ar[1] = @"xxxx"; |
This file contains hidden or 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
$(e.target).closest('li') |
This file contains hidden or 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
for p in ar | |
console.log p |
This file contains hidden or 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
// 遅延 | |
[self performSelector:@selector(onDelay) withObject:nil afterDelay:11.0]; | |
// 遅延(引数有り) | |
[self performSelector:@selector(onDelay:) withObject:@(10) afterDelay:1.0]; | |
- (void)onDelay | |
{ | |
NSLog(@"onDelay"); | |
} |