View gist:56c4b539f937a807b1682f3920ad6e13
This file contains 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
expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) ) |
View JSTableWithFixedHeaderViewController.m
This file contains 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
// Key sections of code for this implementation are placed below | |
@interface JSTableWithFixedHeaderViewController () | |
@property (strong, nonatomic) UIView *fixedHeaderView; | |
@end | |
@implementation JSTableWithFixedHeaderViewController |
View timeago.swift
This file contains 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
func timeAgoSinceDate(date:NSDate, numericDates:Bool) -> String { | |
let calendar = NSCalendar.currentCalendar() | |
let now = NSDate() | |
let earliest = now.earlierDate(date) | |
let latest = (earliest == now) ? date : now | |
let components:NSDateComponents = calendar.components([NSCalendarUnit.Minute , NSCalendarUnit.Hour , NSCalendarUnit.Day , NSCalendarUnit.WeekOfYear , NSCalendarUnit.Month , NSCalendarUnit.Year , NSCalendarUnit.Second], fromDate: earliest, toDate: latest, options: NSCalendarOptions()) | |
if (components.year >= 2) { | |
return "\(components.year) years ago" | |
} else if (components.year >= 1){ |