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
// | |
// RxSwiftMultithreadTests.swift | |
// GoodNotesTests | |
// | |
// Created by Simon Pang on 27/11/2018. | |
// Copyright © 2018 Time Base Technology Limited. All rights reserved. | |
// | |
import XCTest | |
import RxSwift |
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
// | |
// ViewController.m | |
// DemoScrolling | |
// | |
// Created by Simon Pang on 30/5/2018. | |
// Copyright © 2018 Simon Pang. All rights reserved. | |
// | |
#import "ViewController.h" |
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
override func sendEvent(_ event: UIEvent) { | |
NSLog("sendEvent \(event)") | |
super.sendEvent(event) | |
var vc = keyWindow!.rootViewController! | |
while vc.presentedViewController != nil { | |
vc = vc.presentedViewController! | |
} | |
// Find hit view | |
if let view = vc.view { |
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
MVMUM Architecture (View ViewModel UseCase Model) | |
V > VM > UC > M ( i.e. direction of dependency) | |
<= direct of flow control | |
=> increasing relevant to domain (i.e. plain object) | |
<= increasing relevant to framework/environment (i.e. platform objects with side effect e.g. native GUI, database) | |
Example: (user login screen) |
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 DNSession : NSObject<NSCopying, NSCoding> | |
@property (copy) NSString *authToken; | |
@property (copy) NSString *userIdentifier; | |
+ (instancetype)defaultSession; | |
- (instancetype)initWithConfiguration:(NSDictionary *)options; | |
@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
- (id)init | |
{ | |
if (self = [super initNibName:nil bundle:nil]) { | |
[[[[self whenViewDidLoad] then:^(id result, NSError *error) { | |
return [self.loginButton whenTouchDown]; | |
}] then:^(id result, NSError *error) { | |
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
- (id)init | |
{ | |
if (self = [super initNibName:nil bundle:nil]) { | |
[[self whenViewDidLoad] then:^(id result, NSError *error) { | |
[[self.loginButton whenTouchDown] then:^(id result, NSError *error) { | |
[[client login:self.loginField.text password:self.passwordField.text] then:^(id result, NSError *error) { | |
[client saveAccessToken:[result token]]; |
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
- (id)init | |
{ | |
if (self = [super initNibName:nil bundle:nil]) { | |
[[self whenViewDidLoad] then:^{ | |
id loginPromise = [client login:self.loginField password:self.passwordField when:[self.loginButton whenTouchDown]]; | |
[UIAlertView presentMessage:^{ return [loginPromise alertError]; } when:[loginPromise whenFail]]; | |
[client saveAccessToken:[self.loginPromise whenSuccess]]; | |
[self presentModalViewController:[RegisterViewController willCreate] when:[self.registerButton whenTouchDown]]; | |
}]; |
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
-- TLC - The Tiny Lua Cocoa bridge | |
-- Note: Only tested on x86_64 with OS X >=10.7.3 & iPhone 4 with iOS 5 | |
-- Copyright (c) 2012, Fjölnir Ásgeirsson | |
-- Permission to use, copy, modify, and/or distribute this software for any | |
-- purpose with or without fee is hereby granted, provided that the above | |
-- copyright notice and this permission notice appear in all copies. | |
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
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
diskutil erasevolume HFS+ "ramdisk" `hdiutil attach -nomount ram://2175854` |
NewerOlder