Skip to content

Instantly share code, notes, and snippets.

View onmyway133's full-sized avatar
😇
What you don't know is what you haven't learned

Khoa onmyway133

😇
What you don't know is what you haven't learned
View GitHub Profile
@onmyway133
onmyway133 / iOS 9 App Transport Security.md
Last active August 28, 2015 02:35 — forked from vinhnx/iOS 9 App Transport Security.md
iOS 9 App Transport Security

iOS 9 App Transport Security

Starting from iOS 9, App Transport Security enforces to use secure HTTPS requests by default.

App Transport Security

App Transport Security (ATS) enforces best practices in the secure connections between an app and its back end. ATS prevents accidental disclosure, provides secure default behavior, and is easy to adopt; it is also on by default in iOS 9 and OS X v10.11. You should adopt ATS as soon as possible, regardless of whether you’re creating a new app or updating an existing one.

If you’re developing a new app, you should use HTTPS exclusively. If you have an existing app, you

@onmyway133
onmyway133 / NS_ENUM
Last active August 29, 2015 13:58
NS_ENUM
typedef NS_ENUM(NSInteger, UITableViewCellStyle) {
UITableViewCellStyleDefault,
UITableViewCellStyleValue1,
UITableViewCellStyleValue2,
UITableViewCellStyleSubtitle
};
@onmyway133
onmyway133 / NSKeyedArchiver
Last active August 29, 2015 13:58
NSKeyedArchiver
Get document directory
NSString *documentDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString *filePath = [documentDir stringByAppendingPathComponent:@"file.bin"];
Save
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:object];
[NSKeyedArchiver archiveRootObject:data toFile:filePath];
Load
NSData *data = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];
@onmyway133
onmyway133 / Suppress Xcode warning
Last active August 29, 2015 14:02
Suppress Xcode warning
Deprecated declarations
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
NSLog(@"Your code goes here");
#pragma clang diagnostic pop
PerformSelector
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
[self.ticketTarget performSelector: self.ticketAction withObject: self];
@onmyway133
onmyway133 / Xcode Select
Last active August 29, 2015 14:03
Xcode Select
// Xcode 6 Beta to use Swift REPL
sudo xcode-select -switch /Applications/Xcode6-Beta.app/Contents/Developer
xcrun swift
lldb --repl
// Xcode 5
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
@onmyway133
onmyway133 / Adding Sublime Text 2 to command line
Last active August 29, 2015 14:03
Adding Sublime Text 2 to command line
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /bin/subl
@onmyway133
onmyway133 / Install homebrew
Last active August 29, 2015 14:03
Install homebrew
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
@onmyway133
onmyway133 / Install MacPort
Last active August 29, 2015 14:03
Install MacPort
Download for Mavericks https://guide.macports.org/chunked/installing.macports.html
Edit ~/.zshrc
export PATH="/opt/local/bin:/usr/local/bin:$PATH"
@onmyway133
onmyway133 / Install macvim
Last active August 29, 2015 14:03
Install macvim
brew install macvim --env-std --override-system-vim
brew linkapps
Usage
mvim
@onmyway133
onmyway133 / Install oh-my-zsh
Last active August 29, 2015 14:03
Install oh-my-zsh
curl -L http://install.ohmyz.sh | sh