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
#!/usr/bin/ruby | |
projects = Dir.glob("*.xcworkspace") + Dir.glob("*.xcodeproj") | |
if projects.count > 1 | |
puts "Choose file to open:" | |
projects.each_index do |i| | |
num = i + 1 | |
puts "#{num}: #{projects[i]}" | |
end |
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 ConstraintAttribute | |
attr_reader :name | |
attr_reader :multiplier | |
attr_reader :constraint | |
attr_reader :relation | |
def initialize(constraint, name) | |
@constraint, @name = constraint, name | |
@constant, @multiplier = 0, 1 | |
end |
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
@interface ActionSheetItem : NSObject | |
@property (copy, nonatomic) NSString *title; | |
@property (nonatomic, getter=isDestructive) BOOL destructive; | |
@property (nonatomic, getter=isCancel) BOOL cancel; | |
@property (copy, nonatomic) void (^actionBlock)(); | |
@property (nonatomic) SEL action; |
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
#define str(T) _Generic( (T), SEL: NSStringFromSelector, Class: NSStringFromClass) (T) | |
NSString *cancelAction = str(@selector(cancel:)); | |
NSString *objectClassName = str([NSObject class]); |
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 String | |
def discover | |
puts self + ' ' + self.ord.to_s(16) | |
end | |
end | |
# Аа Бб Вв Гг Дд Єє Ее | |
# Жж Ѕѕ Ꙁꙁ Ии Іі Її Ћћ | |
# Кк Лл Мм Нн Оо Пп Рр | |
# Сс Тт Уу Ꙋꙋ Фф Хх Ѿѿ |
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
@interface MyManagedObjectContext : NSManagedObjectContext | |
- (instancetype)main; | |
- (instancetype)newBackground; | |
- (instancetype)newUI; | |
- (NSArray *)fetch:(id)query; | |
- (id)fetchFirst:(id)query; |
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
protocol Attributed { | |
var attrs: Attrs { get } | |
} | |
struct Attrs { | |
let name: String | |
let sortBy: String | |
let keyPath: [String] | |
// init has defaults |
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 | |
protocol AnyValidator { | |
func validate(any: Any) -> Bool | |
} | |
protocol Validator: AnyValidator { | |
associatedtype Value | |
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
interface Transformer<A, B> { | |
B.Element transform(A.Element a); | |
} |
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
// Abstract interface | |
protocol Interactor: class { | |
associatedtype Action | |
func dispatch(action: Action) | |
init() | |
} | |
protocol Presenter: class { | |
associatedtype State |
OlderNewer