Skip to content

Instantly share code, notes, and snippets.

View sumitmundra's full-sized avatar

Sumit Mundra sumitmundra

View GitHub Profile
import UIKit
import EventKit
import EventKitUI
typealias EventsCalendarManagerResponse = (_ result: ResultCustomError<Bool, CustomError>) -> Void
class EventsCalendarManager: NSObject {
var eventStore: EKEventStore!
@sumitmundra
sumitmundra / UIApplication+PhoneCapability.h
Created March 25, 2016 12:26 — forked from maciekish/UIApplication+PhoneCapability.h
UIApplication+PhoneCapability. Detects whether the device can actually place a phone call.
//
// UIApplication+PhoneCapability.h
//
// Copyright (c) 2014 Maciej Swic
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@sumitmundra
sumitmundra / UINavigationBar+CustomHeight.h
Created March 25, 2016 12:26 — forked from maciekish/UINavigationBar+CustomHeight.h
Custom UINavigationBar height working in iOS 7 and 8. To use, find your navigation bar reference and just setHeight:200 etc.
//
// UINavigationBar+CustomHeight.h
//
// Copyright (c) 2014 Maciej Swic
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@sumitmundra
sumitmundra / Macros.h
Last active August 29, 2015 14:24 — forked from numo16/Macros.h
#define ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])
#define UserDefaults [NSUserDefaults standardUserDefaults]
#define NotificationCenter [NSNotificationCenter defaultCenter]
#define SharedApplication [UIApplication sharedApplication]
#define Bundle [NSBundle mainBundle]
#define MainScreen [UIScreen mainScreen]
#define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES
#define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO
#define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x
#define NavBar self.navigationController.navigationBar
@interface UIImage (fixOrientation)
- (UIImage *)fixOrientation;
@end

Get all USDA servings

If you want to retrieve a list of items by their NDB number (an id assigned by the USDA). Then you can send Nutritionix a filter to get all its sizes. "remote_db_id":3 tells us to filter by our USDA database and "remote_db_key":11143 tells us to filter by the NDB number.

curl -XPOST https://api.nutritionix.com/v1_1/search -d'
{
  "appId":"YOUR_APP_ID",
  "appKey":"YOUR_APP_KEY",