Skip to content

Instantly share code, notes, and snippets.

Petro Korienev soxjke

Block or report user

Report or block soxjke

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@soxjke
soxjke / AWSIdentityManager+Fixtures.h
Last active Apr 8, 2019
AWSAuthCore crash workaround
View AWSIdentityManager+Fixtures.h
#import <AWSAuthCore/AWSAuthCore.h>
@interface AWSIdentityManager (Fixtures)
@end
@soxjke
soxjke / PINCodeView.h
Last active Feb 24, 2019
PINCodeField
View PINCodeView.h
@interface PINCodeView : UIView
- (instancetype)initWithNumberOfDigits:(NSUInteger)digits
keyboardType:(UIKeyboardType)keyboardType
autocapitalizationType:(UITextAutocapitalizationType)autocapitalizationType;
@property (nonatomic, copy) NSString *code;
- (void)becameFirstResponder;
@end
View Message forwarding
- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel {
NSMethodSignature * __block signature = nil;
[self.implementations enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
signature = [obj methodSignatureForSelector:sel];
*stop = (nil != signature);
}];
return signature;
}
- (BOOL)respondsToSelector:(SEL)aSelector {
View ViewModel.swift
enum UIState {
case current
case forecast(page: Int)
}
enum UIEvent {
case turnCurrent
case turnForecast
case turnLeft
case turnRight
View ViewController.swift
func setupObserving() {
currentWeatherView.reactive.weatherFeatures <~ viewModel.weatherFeatures
loadingIndicator.reactive.isAnimating <~ viewModel.isLoading
segmentedControl.reactive.isEnabled <~ viewModel.isEnabledControl(for: Set([.turnCurrent, .turnForecast]))
reactive.title <~ viewModel.title
reactive.rightBarButtonItem <~ viewModel.isLoading.map { [weak self] (isLoading) -> UIBarButtonItem? in
return isLoading ? self?.loadingBarButtonItem : self?.refreshBarButtonItem
}
@soxjke
soxjke / right
Last active Feb 15, 2018
comma-separated
View right
255, 1, 1, 1, 0
2233, 0, 1, 1, 1
@soxjke
soxjke / right
Last active Feb 15, 2018
No headline
View right
255, 1, 1, 1, 0
2233, 0, 1, 1, 1
View ComplexWay.swift
import UIKit
public protocol NibInstantiator {
associatedtype Base
func instantiate() -> Base
}
public extension NibInstantiator where Base: UIView {
public func instantiate() -> Base {
guard let view =
View AuthManager.swift
enum AuthError: Error {
case wrongAuthData,
case wrongDeauthData
}
class AuthManager {
let networkManager: // injected dependency
func deauthenticateUser(user: User) -> SignalProducer<User, AuthError> {
// perhaps go to network:
return SignalProducer { (observer, disposable) in
View UploadServiceImpl.swift
enum TestError: Swift.Error {
case uploadFailed
}
class Album {
let pages: [Page] = []
}
class Page {}
class UploadServiceImpl {
private(set) lazy var addAction = Action<Album, Void, TestError>(execute:self.addActionBlock)
private lazy var pageAction = Action<Page, Void, TestError>(execute:self.pageActionBlock)
You can’t perform that action at this time.