Skip to content

Instantly share code, notes, and snippets.

@jacks205
jacks205 / gist:56c4b539f937a807b1682f3920ad6e13
Created Oct 13, 2016 — forked from krzysztofzablocki/gist:4396302
Set symbol breakpoint on objc_msgSend then setup this debug command to log all methods called in iOS Simulator. If you want to do device debugging change esp+4 register to r0, esp+8 to r1 Found long ago somewhere on stackoverflow.
View gist:56c4b539f937a807b1682f3920ad6e13
expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) )
View JSTableWithFixedHeaderViewController.m
// Key sections of code for this implementation are placed below
@interface JSTableWithFixedHeaderViewController ()
@property (strong, nonatomic) UIView *fixedHeaderView;
@end
@implementation JSTableWithFixedHeaderViewController
@jacks205
jacks205 / timeago.swift
Last active Oct 15, 2018 — forked from minorbug/timeago.swift
"Time ago" function for Swift (based on MatthewYork's DateTools for Objective-C) *Swift 2
View timeago.swift
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){