Skip to content

Instantly share code, notes, and snippets.

@capsulecorplab
capsulecorplab / automate_all_the_things.adoc
Last active December 28, 2020 20:40
a list of miscellaneous automation and productivity tools
UIAlertController* <#alert#> = [UIAlertController alertControllerWithTitle:<#name#>
message:<#message#>
preferredStyle:<#UIAlertControllerStyleAlert#>];
void (^<#handler#>)(UIAlertAction * action) = ^(UIAlertAction * action){
};
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:<#@"OK"#> style:<#UIAlertActionStyleDefault#>
handler:<#handler#>];
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active March 24, 2025 20:20
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@snikch
snikch / gist:3661188
Created September 6, 2012 23:16
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}

Objective-C Coding Convention and Best Practices

Most of these guidelines are to match Apple's documentation and community-accepted best practices. Some are derived some personal preference. This document aims to set a standard way of doing things so everyone can do things the same way. If there is something you are not particularly fond of, it is encouraged to do it anyway to be consistent with everyone else.

This document is mainly targeted toward iOS development, but definitely applies to Mac as well.

Operators

NSString *foo = @"bar";