Skip to content

Instantly share code, notes, and snippets.

View reddavis's full-sized avatar
💭
🍕

Red Davis reddavis

💭
🍕
View GitHub Profile
@calebd
calebd / ArrayHelpers.swift
Last active January 29, 2025 06:05
Swift Helpers
extension Array {
func first() -> Element? {
if isEmpty {
return nil
}
return self[0]
}
func last() -> Element? {
@mwaterfall
mwaterfall / gist:953656
Created May 3, 2011 16:23
Useful Objective-C Preprocessor Macros
#define ApplicationDelegate ((MyAppDelegate *)[[UIApplication sharedApplication] delegate])
#define UserDefaults [NSUserDefaults standardUserDefaults]
#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
#define TabBar self.tabBarController.tabBar