Skip to content

Instantly share code, notes, and snippets.

View piaoapiao's full-sized avatar

piaoapiao

  • china shanghai
View GitHub Profile
/*
* 发包开关
*/
#define kProductionEnv YES
#if !kProductionEnv
else if ([dict[@"type"] isEqualToString:@"mine_download"]) {
NSString *downloadUrl = @"https://www.pgyer.com/Mzjk";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:downloadUrl]];
@piaoapiao
piaoapiao / gist:bd25b3cdc5bf1671157a
Created January 7, 2016 08:26
locate bug by command
guodongdeMacBook-Pro:header guodong$ strings TencentOpenAPI |grep ConnectionAppId
__ZN15CTXAppidConvert17IsConnectionAppIdEPKc
GetConnectionAppId
GetConnectionAppId
@piaoapiao
piaoapiao / gist:6d23ef07f168818548d2
Last active December 30, 2015 07:48
4舍5入 保留小数点后2位
NSDecimalNumber *subtotal = [NSDecimalNumber decimalNumberWithString:@"90.7146"];
//保留小数点后两位
NSDecimalNumberHandler*roundUp = [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundBankers scale:2 raiseOnExactness:NO raiseOnOverflow:NO raiseOnUnderflow:NO raiseOnDivideByZero:YES];
NSDecimalNumber*total = [subtotal decimalNumberByRoundingAccordingToBehavior:roundUp];
NSLog(@"total:%@",total);
@piaoapiao
piaoapiao / gist:02e581049e31a5fbf681
Created August 6, 2014 22:51
container introduce
https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html
@piaoapiao
piaoapiao / gist:11322102
Created April 26, 2014 14:52
过滤中文输入
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(textFiledEditChanged:)
name:@"UITextFieldTextDidChangeNotification"
object:self.bBankCardbyName];
-(void)textFiledEditChanged:(NSNotification *)obj{
UITextField *textField = (UITextField *)obj.object;
NSLog(@"textField:%@",textField.text);
http://stablekernel.com/blog/view-controller-containers-part-ii/
IPA 重签名
Step1 : 解压IPA
unzip MYAPP.ipa
Step2: 删除旧的代码签名
rm -rf Payload/ MYAPP.app/_CodeSignature
Step3: 更换证书
cp MyEnterprise.mobileprovision Payload/ MYAPP.app/embedded.mobileprovision
Step4: 重签名
@piaoapiao
piaoapiao / gist:9203619
Created February 25, 2014 06:09
section 和 cell 整体移动
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView == self.cardTableView)
{
CGFloat sectionHeaderHeight = 80;
if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) {
scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
} else if (scrollView.contentOffset.y>=sectionHeaderHeight) {
scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
}
}
@piaoapiao
piaoapiao / gist:4662599
Created January 29, 2013 08:07
semaphore test
- (void)viewDidLoad
{
[super viewDidLoad];
semaphoreTest = dispatch_semaphore_create(2);
[NSThread detachNewThreadSelector:@selector(workThread) toTarget:self withObject:nil];
[NSThread detachNewThreadSelector:@selector(workThread2) toTarget:self withObject:nil];
[NSThread detachNewThreadSelector:@selector(workThread3) toTarget:self withObject:nil];
UIButton *text = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 50, 30)];
text.backgroundColor = [UIColor redColor];
[text addTarget:self action:@selector(testSemaphore) forControlEvents:UIControlEventTouchUpInside];
@piaoapiao
piaoapiao / gist:4578356
Created January 20, 2013 12:40
国外软件站点 by piaoapiao
http://torfinder.net/torrent/c6d96e1ae7f29f0175f551d9c2a3513a58ca8637