Skip to content

Instantly share code, notes, and snippets.

@scottandrus
scottandrus / gist:5053574
Created February 28, 2013 01:58
VandyMobile Dining Scraper
- (void)downloadAndParseMenuForDate:(NSDate *)date {
[self parseHppleMenu:
[self downloadMenuForDateComponents:
[self componentsFromCurrentDate:date]]];
}
- (NSDateComponents *)componentsFromCurrentDate:(NSDate *)today {
NSCalendar *gregorian = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];
return [gregorian components:(NSDayCalendarUnit
@scottandrus
scottandrus / gist:4081316
Created November 15, 2012 21:15
AFNetworking Image Downloads with Download Progress Block
- (void)downloadMultiAFN {
// Basic Activity Indicator to indicate download
UIActivityIndicatorView *loading = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[loading startAnimating];
[self.imageView.superview addSubview:loading];
loading.center = self.imageView.center;
// Create a request from the url, make an AFImageRequestOperation initialized with that request
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.picUrl]];
AFImageRequestOperation *op = [[AFImageRequestOperation alloc] initWithRequest:request];