Skip to content

Instantly share code, notes, and snippets.

View sosoyososo's full-sized avatar

Karsa.Wang sosoyososo

View GitHub Profile
@sosoyososo
sosoyososo / gist:6137793
Created August 2, 2013 06:03
立方体旋转的动画代码
CATransition *animation = [CATransition animation];
animation.duration = 2.0;
animation.type = @"cube";
animation.subtype = kCATransitionFromRight;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[sender removeFromSuperview];
if ([sender isEqual:self.button1]) {
[self.animationView addSubview:self.button2];
} else {
[self.animationView addSubview:self.button1];
@sosoyososo
sosoyososo / gist:6085275
Last active December 20, 2015 06:19
查询一个目录下面所有.h.m.mm文件中class的对应关系,理出类的层次
#1.遍历某个路径的子目录
#2.按行读取头文件和源文件
#3.找到对应关系行
#4.判断是否在注释范围内
#5.分析并存储关系
import os, os.path, re, sys
_g_relations = {}
_g_graphRelations = {}
@sosoyososo
sosoyososo / gist:5418189
Created April 19, 2013 04:41
catch NSException and output info
void handleException(NSException *exception) {
NSString *exceptionString = [NSString stringWithFormat:@"NSException : %@", [exception description]];
NSArray *arrsy = [exception callStackSymbols];
NSLog(@"//////////////////////////////////////////////////////////////////////////////////////////");
NSLog (@"%@ : %@", exceptionString, arrsy);
NSLog(@"//////////////////////////////////////////////////////////////////////////////////////////");
}
@sosoyososo
sosoyososo / gist:5193123
Created March 19, 2013 02:05
Objective-C 使用AFHttpWorking进行OAuth2.0 的 github 认证
AFHTTPClient *post = [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:@"https://api.github.com"]];
[post setAuthorizationHeaderWithUsername:@"" password:@""];
post.parameterEncoding = AFJSONParameterEncoding;
[post postPath:@"authorizations"
parameters:@{@"Scopes":@[@"public_repo",@"repo"],@"note":@"admin script"}
success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSString *responseStr = [[NSString alloc] initWithData:responseObject encoding:4];
NSLog(@"success : %@", responseStr);
}
failure:^(AFHTTPRequestOperation *operation, NSError *error) {