Skip to content

Instantly share code, notes, and snippets.

View vc7's full-sized avatar
🇹🇼
ミルクティー大好き

Lihsuan Chen vc7

🇹🇼
ミルクティー大好き
View GitHub Profile
北海道
青森県
岩手県
宮城県
秋田県
山形県
福島県
茨城県
栃木県
群馬県
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Information</key>
<dict>
<key>Description</key>
<string>Map Rails ActiveSupport timezones to iOS readable timezone IDs.</string>
<key>Version</key>
<string>1.0</string>
@vc7
vc7 / Big5toUTF8.m
Created August 22, 2014 08:30 — forked from zonble/Big5toUTF8.m
NSStringEncoding big5 = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingBig5_HKSCS_1999);
NSString *string = [[NSString alloc] initWithData:data encoding:big5];
NSData *UTF8Data = [string dataUsingEncoding:NSUTF8StringEncoding];
[string release];

Objective-C Coding Convention and Best Practices

Most of these guidelines are to match Apple's documentation and community-accepted best practices. Some are derived some personal preference. This document aims to set a standard way of doing things so everyone can do things the same way. If there is something you are not particularly fond of, it is encouraged to do it anyway to be consistent with everyone else.

This document is mainly targeted toward iOS development, but definitely applies to Mac as well.

Operators

NSString *foo = @"bar";
NSString *boundary = @"cce6735153bf14e47e999e68bb183e70a1fa7fc89722fc1efdf03a917340";
// create request
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
[request setHTTPShouldHandleCookies:NO];
[request setTimeoutInterval:30];
[request setHTTPMethod:@"POST"];
// set Content-Type in HTTP header
NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
[params setObject:@"your custom message" forKey:@"message"];
[params setObject:UIImagePNGRepresentation(_image) forKey:@"picture"];
_shareToFbBtn.enabled = NO; //for not allowing multiple hits
[FBRequestConnection startWithGraphPath:@"me/photos"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
id result,