This file contains hidden or 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)controllerWillChangeContent:(NSFetchedResultsController *)controller | |
| { | |
| self.shouldReloadCollectionView = NO; | |
| self.blockOperation = [[NSBlockOperation alloc] init]; | |
| } | |
| - (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id<NSFetchedResultsSectionInfo>)sectionInfo | |
| atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type | |
| { | |
| __weak UICollectionView *collectionView = self.collectionView; |
This file contains hidden or 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
| // please... don't do this | |
| import Foundation | |
| class F: NSObject | |
| { | |
| @objc func foo() { | |
| print("hi") | |
| } | |
| } |
This file contains hidden or 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
| module type CELL = sig | |
| type 'a cell | |
| type 'a exp | |
| val return : 'a -> 'a exp | |
| val (>>=) : 'a exp -> ('a -> 'b exp) -> 'b exp | |
| val cell : 'a exp -> 'a cell exp | |
| val get : 'a cell -> 'a exp |
This file contains hidden or 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
| /// To use reduce() to sum a sequence, we need | |
| /// | |
| /// - a zero (identity) element | |
| /// - an addition operator | |
| protocol Summable { | |
| /// Identity element for this type and the + operation. | |
| static var Zero: Self { get } | |
This file contains hidden or 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
| /* | |
| * This is an example provided by Facebook are for non-commercial testing and | |
| * evaluation purposes only. | |
| * | |
| * Facebook reserves all rights not expressly granted. | |
| * | |
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
| * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL | |
| * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
This file contains hidden or 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
| {% block head %} | |
| {{ parent() }} | |
| <meta name="description" content="{{ entry.body | trimit(400) }}" /> | |
| <link rel="canonical" href="{{ entry.url }}"> | |
| <meta name="author" content="{{ siteName }}"> | |
| <!-- Schema.org markup for Google+ --> | |
| <meta itemprop="name" content="{{ entry.title }}"> | |
| <meta itemprop="description" content="{{ entry.body | trimit(400) }}"> | |
| <meta itemprop="image" content="{% if image %}{{ image.getUrl('large') }}{% endif %}"> |
This file contains hidden or 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
| NSString *const ToyboxNotification = @"com.sadun.ToyboxNotification"; | |
| NSString *const kIdentity = @"kIdentity"; | |
| NSString *const kTrigger = @"kTrigger"; | |
| NSString *const kString = @"kString"; | |
| NSString *const kValue = @"kValue"; | |
| NSString *const kRadio = @"kRadio"; | |
| NSString *const kRadioRow = @"kRadioRow"; | |
| NSString *const kRadioColumn = @"kRadioColumn"; | |
| @implementation AppDelegate |
This file contains hidden or 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
| -(CGRect)frameForImage:(UIImage*)image inImageViewAspectFit:(UIImageView*)imageView | |
| { | |
| float imageRatio = image.size.width / image.size.height; | |
| float viewRatio = imageView.frame.size.width / imageView.frame.size.height; | |
| if(imageRatio < viewRatio) | |
| { | |
| float scale = imageView.frame.size.height / image.size.height; | |
This file contains hidden or 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
| public struct Distance :NumericType { | |
| public var value :Double | |
| public init(_ value: Double) { | |
| self.value = value | |
| } | |
| } | |
| extension Distance :IntegerLiteralConvertible { | |
| public init(integerLiteral: IntegerLiteralType) { | |
| self.init(Double(integerLiteral)) |
This file contains hidden or 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 Foundation | |
| protocol GQLNodeArgument {} | |
| extension String: GQLNodeArgument {} | |
| extension NSNumber: GQLNodeArgument {} | |
| class GQLNode: StringLiteralConvertible, ArrayLiteralConvertible, Printable, DebugPrintable { | |
| let name: String? |