Skip to content

Instantly share code, notes, and snippets.

Michael Fellows mafellows

Block or report user

Report or block mafellows

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mafellows /
Created Apr 5, 2018 — forked from PurpleBooth/
A template to make good

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.


View gist:bb18477ec6d25f70cac7a8f327c7407e
UNUserNotificationCenter.current().getNotificationSettings { settings in
let authorizationStatus: UNAuthorizationStatus = settings.authorizationStatus
// Handle authorization status
View gist:f79d81a87b99417b8e0db3c26b261fde
// Generates a compiler error
foos.forEach { foo in
guard let bar = foo else { continue }
// Works fine.
for foo in foos {
guard let bar = foo else { continue }
View gist:417acc60566fc8e8e9db8700c61ce06f
Only fetch the keys you need when doing queries.
Fetching lots of info per contact is a big performance hit.
let keys = CNContactFormatter.descriptorForRequiredKeys(for: .fullName)
// This will get contacts from the default container.
let contactStore = CNContactStore()
let defaultContainerIdentifier = contactStore.defaultContainerIdentifier()
View gist:c25816672688428344df
Map<String, String> videoParams = new HashMap<String, String>();
// This is an example of logging the 'Ooh La La' video as it's played
videoParams.put("video", "Played_Ooh_La_La_Video");
// Make sure the event name for all videos is 'Played_Video'
FlurryAgent.logEvent("Played_Video", videoParams);
View gist:9b78449a91e5b2668c93
if ([PFUser currentUser]) {
PFInstallation *currentInstallation = [PFInstallation currentInstallation];
NSString *userId = currentInstallation[@"installationUser"];
if (![userId isEqualToString:[[PFUser currentUser] objectId]]) {
currentInstallation[@"installationUser"] = [[PFUser currentUser] objectId];
[currentInstallation saveEventually];
View gist:65de799315c053a464f4
- (void)logInWithTwitter
[PFTwitterUtils logInWithBlock:^(PFUser *user, NSError *error) {
if (error) {
NSLog(@"Failed to login with Twitter..");
} else if (user.isNew) {
// Get information for new user
NSURL *verify = [NSURL URLWithString:@""];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:verify];
View gist:a2a32fb6c570dbdde9a9
label.font = [UIFont fontWithName:@"GillSans-Bold" size:28.0f]; // GilSans-Bold size 28 font
label.shadowColor = [UIColor blackColor]; // Black shadow color
label.shadowOffset = CGSizeMake(2.0f, 2.0f); // Width and height of the shadow offset
label.layer.shadowRadius = 1.0f; // The blur radius (in points) used to render the layer’s shadow
label.layer.shadowOpacity = 1.0f; // The opacity of the layer’s shadow
View gist:cb08fb5264beeb7e2b80
// The %@ characters are placeholders for the string. %@ %@ %@&email=%@&address=%@&city=%@&state=%@&country=%@&zip=%@&phone=%@&fax=%@&date=%@&score=%f&ipad=%@&businessName=%@&serialNum=%@&licenseNum=%@
View gist:d77574d1f3187a3afe56
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
NSString *urlString = [url absoluteString];
if ([urlString rangeOfString:@"from-dealer"].location != NSNotFound) {
NSLog(@"This application was launched from the dealer app!");
return YES;
return NO;
You can’t perform that action at this time.