Skip to content

Instantly share code, notes, and snippets.

- (NSArray *)fetchPopularSearches {
__block NSMutableArray *result = [NSMutableArray array];
NSString *searchQuery = [NSString stringWithFormat:@"url_to_flights_json"];
NSURL *url = [[NSURL alloc] initWithString:searchQuery];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request
success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON)
{
- (void)decomposeFlightsPerHour {
self.decomposedFlights = [NSMutableDictionary dictionary];
NSMutableArray *temp = [NSMutableArray array];
NSString *currentHourPrefix = [[[self.flightList objectAtIndex:0] objectForKey:@"HP"] substringToIndex:2];
NSString *dateHourPrefix = [[[self.flightList objectAtIndex:0] objectForKey:@"DATEVOL"] substringToIndex:10];
NSString *newPrefix = [NSString stringWithFormat:@"%@_%@", dateHourPrefix, currentHourPrefix];
for (NSDictionary *flightInfo in self.flightList) {
{
"id": 27,
"description": "Raviver la flamme, c est mettre du piment dans sa vie de couple. Savez vous le surprendre ? Faîtes le test !",
"urlKey": "/api/v1/fr/tests/27",
"title": "Savez-vous le surprendre?",
"target_sex": "",
"credits": 15,
"logo": "",
"pictureURL": "/images/img_atoutsSeduction.png",
"score_based": false,
{
"id": 27,
"description": "Raviver la flamme, c est mettre du piment dans sa vie de couple. Savez vous le surprendre ? Faîtes le test !",
"urlKey": "/api/v1/fr/tests/27",
"title": "Savez-vous le surprendre?",
"target_sex": "",
"credits": 15,
"logo": "",
"pictureURL": "/images/img_atoutsSeduction.png",
"score_based": false,
@jsooriah
jsooriah / UINavigationController+Fade.h
Created October 2, 2015 12:51 — forked from ksm/UINavigationController+Fade.h
UINavigationController custom pop/push transition animation
/*
Copied and pasted from David Hamrick's blog:
Source: http://www.davidhamrick.com/2011/12/31/Changing-the-UINavigationController-animation-style.html
*/
@interface UINavigationController (Fade)
- (void)pushFadeViewController:(UIViewController *)viewController;
- (void)fadePopViewController;
@jsooriah
jsooriah / iOS-UploadImage.h
Created October 24, 2015 13:12 — forked from mombrea/iOS-UploadImage.h
example of a multi-part form post in objective-c
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"REST URL PATH"]];
NSData *imageData = UIImageJPEGRepresentation(image, 1.0);
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
[request setHTTPShouldHandleCookies:NO];
[request setTimeoutInterval:60];
[request setHTTPMethod:@"POST"];
NSString *boundary = @"unique-consistent-string";
@jsooriah
jsooriah / books.md
Created May 25, 2020 10:29 — forked from abstractart/books.md
Free Programming Ebooks - O'Reilly Media. Codeship free ebooks here - https://bit.ly/2oQ0knQ