Skip to content

Instantly share code, notes, and snippets.

View mmesarina's full-sized avatar

Malena Mesarina mmesarina

View GitHub Profile
@mmesarina
mmesarina / gist:80d457e2714790bb8533
Created December 12, 2014 02:32
TipCalculator AppDelegate loads ViewController from mainStoryboard
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
TipViewController *tipViewController = [storyboard instantiateInitialViewController];
//self.window.backgroundColor = [UIColor whiteColor];
self.window.rootViewController = tipViewController;
[self.window makeKeyAndVisible];
@mmesarina
mmesarina / gist:34c0af8889e2c339573f
Created December 13, 2014 15:16
Rottentomatoes API to load movies information
NSString *url = @"http://api.rottentomatoes.com/api/public/v1.0/lists/movies/in_theaters.json?apikey=ws32mxpd653h5c8zqfvksxw9";
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
id object = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
self.movies = object[@"movies"];
[self.tableView reloadData];
NSLog(@"%@", object);
}];