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 | |
import SwiftUI | |
import Charts | |
import os | |
struct DataPoint: Identifiable { | |
var id: UUID | |
var interval: Double | |
var iteration: Int | |
} |
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 run this code: | |
// 1. Create a macOS playground from Xcode. | |
// 2. Copy below code into the playground. | |
// 3. Click the Run button to see the console output. | |
import Foundation | |
import CoreData | |
func createObjectModel() -> NSManagedObjectModel { | |
let nameAttr = NSAttributeDescription() | |
nameAttr.name = "username" |
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
extension Optional where Wrapped: IntegerType { | |
func nilOrZero() -> Bool { | |
switch self { | |
case .None: return true | |
case .Some(let value): return value == 0 | |
} | |
} | |
} |
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
let text = "01234567890123456789012345678901234567890123456789" | |
let attributedText = NSMutableAttributedString(string: "\(text)😈😥😈😥😈😥😈😥") | |
attributedText.setAttributes([NSForegroundColorAttributeName: UIColor.blueColor()], | |
range: NSMakeRange(0, text.characters.count)) | |
let label = UILabel(frame: CGRectMake(0, 0, 320, 320)) | |
label.attributedText = attributedText | |
label.lineBreakMode = .ByTruncatingMiddle | |
label.numberOfLines = 2 | |
label.sizeThatFits(label.bounds.size) |
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
struct Stack <Element> { | |
let values: [Element] | |
var elementType: Any { | |
get { | |
return Element.self | |
} | |
} | |
} |
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 UIKit; | |
@interface ViewController : UIViewController <UICollectionViewDelegate, UICollectionViewDataSource> | |
@property (nonatomic, strong) UICollectionView *collectionView; | |
@end | |
@implementation ViewController |
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 -[EditUserWordController viewDidAppear:](void * self, void * _cmd, bool arg2) { | |
rbx = self; | |
var_28 = rbx; | |
var_20 = *0x2bd50; | |
LODWORD(rdx) = LOBYTE(arg2) & 0xff; | |
[[var_28 super] viewDidAppear:rdx]; | |
if ([[rbx targetTextField] delegate] != rbx) { | |
r15 = *objc_msgSend; | |
rdx = [[rbx targetTextField] delegate]; | |
[rbx setOriginalTargetDelegate:rdx]; |