This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
extension Array where Element: FloatingPoint { | |
/// Returns the sum of all elements in the array | |
var total: Element { | |
return reduce(0, +) | |
} | |
/// Returns the average of all elements in the array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"value":"Exported from Microsoft Outlook (Do not delete)\n[outlook:3:1131] \n\nExported from Microsoft Outlook (Do not delete)\n[outlook:3:1131]\n\nExported from Microsoft Outlook (Do not delete)\n[outlook:3:1131] \n\nExported from Microsoft Outlook (Do not delete)\n[outlook:3:1131] \n\nExported from Microsoft Outlook (Do not delete)\n[outlook:3:1131]\n\nExported from Microsoft Outlook (Do not delete)\n[outlook:3:1131]\n\nExported from Microsoft Outlook (Do not delete)\n[outlook:3:1131] \n\nExported from Microsoft Outlook (Do not delete)\n[outlook:3:1131] \n\nExported from Microsoft Outlook (Do not delete)\n[outlook:3:1131]\n\nExported from Microsoft Outlook (Do not delete)\n[outlook:3:1131] \n\nExported from Microsoft Outlook (Do not delete)\n[outlook:3:1131] \n\nExported from Microsoft Outlook (Do not delete)\n[outlook:3:1131]\n\nExported from Microsoft Outlook (Do not delete)\n[outlook:3:1131]\n\nExported from Microsoft Outlook (Do not delete)\n[outlook:3:1131]\n\nExported from Microsoft Outlook (Do not |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ThingManager { | |
var things: [String: Thing] = [:] | |
func addThing(_ thing: Thing) { | |
self.things[thing.address] = thing | |
} | |
func removeThingWith(address: String) { | |
self.things.removeValue(forKey: address) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Message: 11 | |
Date: Fri, 1 Jan 2016 14:21:35 -0800 | |
From: Ethan Diamond <[email protected]> | |
To: Chris Lattner <[email protected]> | |
Cc: [email protected] | |
Subject: Re: [swift-evolution] Closure Syntax | |
Message-ID: | |
<CA+TuH2kozmhFMVKWrjMarc0C9B_Z2mCB=D+GZ10=BC=Kj1fFLA@mail.gmail.com> | |
Content-Type: text/plain; charset="utf-8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
var f_var: () -> String = { | |
return "Wat" | |
} | |
let f1: () -> String = { | |
return "Indubitably" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+- (void)willSave | |
+{ | |
+ static const unichar kUnicharMax = USHRT_MAX; | |
+ NSString *heavyString = [NSString stringWithCharacters:&kUnicharMax length:1]; | |
+ | |
+ self.firstNameSortValue = [self.firstName length] ? self.firstName : heavyString; | |
+ self.lastNameSortValue = [self.lastName length] ? self.lastName : heavyString; | |
+ self.companySortValue = [self.company length] ? self.company : heavyString; | |
+} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)typeButtonTap:(id)sender | |
{ | |
UITableViewCell *cell = (UITableViewCell *)sender; | |
NSIndexPath *path = [self.tableView indexPathForCell:cell]; | |
ESCContactEditViewModelBase *viewModel = [self viewModelForIndexPath:path]; | |
[self displayTypeSelectorForViewModel:viewModel]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "CBKClassToChange.h" | |
@implementation CBKClassToChange | |
+ (void)load | |
{ | |
[NSKeyedUnarchiver setClass:self forClassName:@"CBClassToChange"]; | |
} | |
- (void)encodeWithCoder:(NSCoder *)aCoder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// .h | |
@interface mySingleton : NSObject | |
@property (nonatomic, strong) id someData; | |
+ (id)sharedInstance; | |
+ (void)probablySuperfluousStartup; | |
+ (void)probablyUnnecessaryShutdown; | |
@end | |
/// .m | |
static mySingleton *sharedInstance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setDelegate:(id<UINavigationControllerDelegate>)delegate | |
{ | |
[NSException raise:@"Wrong delegate error" format:@"You're actually using this? 99% sure you meant mailComposerDelegate"]; | |
} |
NewerOlder