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)applicationDidFinishLaunching:(NSNotification *)aNotification { | |
InstallSignalHandler(); | |
InstallUncaughtExceptionHandler(); | |
} | |
typedef struct Test | |
{ | |
int a; | |
int b; | |
}Test; |
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
set -e | |
title='千尋影視' # dmg 文件 mount 了之后在文件系统中显示的名称 | |
background_picture_name='mac-dmg-bg.png' # dmg 文件在 mount 了之后界面中显示的背景图片路径 | |
application_name='千尋影視.app' # 应用程序的名称 | |
# Developer ID 证书的名称(名字的一部分即可,但是需要能在 Keychain Access 中唯一定位到该证书) | |
developer_id='Developer ID Application: Shanghai Truecolor Multimedia' | |
# dmg 窗口相关的一些设置,需要根据实际情况做变更 | |
window_left=200 # 窗口位置的 x 坐标 |
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
#define FileHashDefaultChunkSizeForReadingData 1024*8 | |
#include <CommonCrypto/CommonDigest.h> | |
+ (NSString*)getFileMD5WithPath:(NSString*)path | |
{ | |
return (__bridge_transfer NSString *)FileMD5HashCreateWithPath((__bridge CFStringRef)path, FileHashDefaultChunkSizeForReadingData); | |
} | |
CFStringRef FileMD5HashCreateWithPath(CFStringRef filePath,size_t chunkSizeForReadingData) { | |
// Declare needed variables |
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
NSString *num1 = @"2.7.14.2345"; | |
NSString *num2 = @"2.12.8.1234"; | |
//2.7.14.2345 | |
// 2.12.8.1234 | |
if ([num1 compare:num2 options:NSNumericSearch] == NSOrderedDescending) { | |
NSLog(@"%@ is bigger",num1); | |
}else | |
{ | |
NSLog(@"%@ is bigger",num2); | |
} |
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
// | |
// FPSLabel.swift | |
// SAC | |
// | |
// Created by SAGESSE on 2/1/16. | |
// Copyright © 2016-2017 Sagesse. All rights reserved. | |
// | |
// Reference: ibireme/YYKit/YYFPSLabel | |
// |
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
@implementation ViewController{ | |
BOOL end; | |
} | |
– (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
NSLog(@”start new thread …”); | |
[NSThread detachNewThreadSelector:@selector(runOnNewThread) toTarget:self withObject:nil]; | |
while (!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
[request setValue:[NSString stringWithFormat:@"%@", [[NSLocale preferredLanguages] componentsJoinedByString:@", "]], forHTTPHeaderField:@"Accept-Language"]; |
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
UILabel *placeHolderLabel = [[UILabel alloc] init]; | |
placeHolderLabel.text = LDLocalizedString(@"xxxxxxxxx"); | |
placeHolderLabel.numberOfLines = 0; | |
placeHolderLabel.textColor = [UIColor lightGrayColor]; | |
[placeHolderLabel sizeToFit]; | |
[self.userTextView addSubview:placeHolderLabel]; | |
// same font | |
placeHolderLabel.font = self.userTextView.font; |
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
static dispatch_queue_t get_queue() { | |
static dispatch_queue_t queue; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
dispatch_queue_attr_t attr = DISPATCH_QUEUE_SERIAL; | |
if (NSFoundationVersionNumber >= NSFoundationVersionNumber_With_QoS_Available) { | |
attr = dispatch_queue_attr_make_with_qos_class(attr, QOS_CLASS_BACKGROUND, 0); | |
} | |
queue = dispatch_queue_create("xxxx.yyy.zzz", attr); | |
}); |
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
@interface UIImage (fixOrientation) | |
- (UIImage *)fixOrientation; | |
@end |
NewerOlder