# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Display App Swithcer on all screens
defaults write com.apple.Dock appswitcher-all-displays -bool true
# Set a shorter Delay until key repeat
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
extension Reactive where Base: UIViewController { | |
var viewDidLoad: Observable<Void> { | |
return self.sentMessage(#selector(Base.viewDidLoad)).map { _ in Void() } | |
} | |
var viewWillAppear: Observable<Bool> { | |
return self.sentMessage(#selector(Base.viewWillAppear)).map { $0.first as? Bool ?? false } | |
} | |
var viewDidAppear: Observable<Bool> { |
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
import Foundation | |
import RxSwift | |
import Genome | |
import PureJsonSerializer | |
enum JsonError: String { | |
case CouldNotParseJSON | |
} | |
extension JsonError: ErrorType { } |
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
// Create CustomView.xib, set File's Owner to CustomView. | |
class CustomView : UIView { | |
// other outlets | |
override init(frame: CGRect) { // for using CustomView in code | |
super.init(frame: frame) | |
self.commonInit() | |
} |
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
#import <UIKit/UIKit.h> | |
IB_DESIGNABLE | |
@interface CustomView : UIView | |
@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
// First | |
dispatch_group_t group = dispatch_group_create(); | |
dispatch_group_async(group,dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ { | |
// block1 | |
NSLog(@"Block1"); | |
[NSThread sleepForTimeInterval:5.0]; | |
NSLog(@"Block1 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
- (void)handlePinchGesture:(UIPinchGestureRecognizer *)gestureRecognizer { | |
if([gestureRecognizer state] == UIGestureRecognizerStateBegan) { | |
self.lastScale = self.effectiveScale; | |
} | |
self.effectiveScale = self.lastScale * gestureRecognizer.scale; | |
if (self.effectiveScale < 1.0) { | |
self.effectiveScale = 1.0; | |
} |
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
viewDidLoad() { | |
self.extendedLayoutIncludesOpaqueBars = YES; | |
self.edgesForExtendedLayout = UIRectEdgeNone; | |
} |
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
# Rime default settings | |
# encoding: utf-8 | |
config_version: "0.34" | |
# 原本的輸入法只有拼音 | |
# 需修改schema_list | |
# 改成 bopomofo | |
schema_list: | |
- schema: bopomofo |
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
Titanium.Facebook.requestWithGraphPath(ID + CONNECTION_TYPE, { | |
message : 'hello~' | |
}, "POST", function(e) { | |
if(e.success) { | |
alert('success'); | |
} else if(e.error) { | |
alert(e.error); | |
} else { |
NewerOlder