This file contains hidden or 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
ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init]; | |
[library addAssetsGroupAlbumWithName:@"Custom Card" resultBlock:^(ALAssetsGroup *group) { | |
NSLog(@"create success"); | |
} failureBlock:^(NSError *error) { | |
NSLog(@"create fanilure"); | |
}]; |
This file contains hidden or 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
function doClick(e) { | |
alert('Clicked!'); | |
} | |
// Remove the event listener like this: | |
// $.myWidget.off("click", doClick); | |
$.index.open(); |
This file contains hidden or 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
1. 生成keystore | |
注册在填写名子与姓氏时需要填写tomcat的主机ip地址 | |
keytool -genkey -v -alias tomcat -keyalg RSA -keystore tomcat.keystore -validity 365 | |
2. 准备生成 CA 的key | |
openssl genrsa -out myCA.key 2048 | |
3. 生成 CA | |
openssl req -x509 -new -key myCA.key -out myCA.cer -days 730 -subj /CN="Sencloudx Custom CA" | |
4. 准备从 CA 请求认证的请求文件 | |
keytool -certreq -alias tomcat -keystore tomcat.keystore -file server.csr | |
5. 从CA请求认证 |
This file contains hidden or 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
// Create a UIImage from sample buffer data | |
- (UIImage *) imageFromSampleBuffer:(CMSampleBufferRef) sampleBuffer | |
{ | |
// Get a CMSampleBuffer's Core Video image buffer for the media data | |
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); | |
// Lock the base address of the pixel buffer | |
CVPixelBufferLockBaseAddress(imageBuffer, 0); | |
// Get the number of bytes per row for the pixel buffer |
This file contains hidden or 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
NSNumber* old = @(600); | |
NSNumber* new = @(300); | |
NSString* oldStr = [NSString stringWithFormat:@"¥%@ ", old]; | |
NSString* newStr = [NSString stringWithFormat:@"¥%@ ", new]; | |
NSAttributedString* oldAttrStr = [[NSAttributedString alloc] initWithString:oldStr attributes:@{NSStrikethroughStyleAttributeName:@(NSUnderlineStyleNone), NSForegroundColorAttributeName:[UIColor blackColor], NSFontAttributeName:[UIFont boldSystemFontOfSize:20]}]; | |
NSAttributedString* newAttrStr = [[NSAttributedString alloc] initWithString:newStr attributes:@{NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle), NSForegroundColorAttributeName:[UIColor grayColor], NSFontAttributeName:[UIFont boldSystemFontOfSize:20]}]; | |
This file contains hidden or 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 LocationMgr () <CLLocationManagerDelegate> | |
@property (strong, nonatomic) CLLocationManager* locationManager; | |
@property (strong, nonatomic) CLGeocoder* geocoder; | |
@property (assign, nonatomic, getter=isRunning) BOOL running; | |
@end | |
@implementation LocationMgr |
This file contains hidden or 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
有时候在Finder右侧的远程共享内看不到局域网内已经共享的主机,可用如下方法连接 | |
1. 知道ip地址可以直接用在Finder窗口中使用苹果+k连, | |
输入windows的用户和密码即可(有的版本的windows默认关闭了共享帐号登录的)。 | |
2. 也可以这样:smb://pc的ip或者机器名/ | |
http://www.macx.cn/thread-496138-1-1.html |
This file contains hidden or 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
print "@synthesize "$NF" = _"$NF | |
cat tmp2.txt | awk '{print $NF}' | awk -F';' '{print "@synthesize "$1" = _"$1";"}' |
This file contains hidden or 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
方法1 | |
1. 构造AVURLAsset | |
2. 请求key | |
3. 准备播放--检查请求结果 | |
4. 准备播放--检查可否播放 |
This file contains hidden or 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
/** | |
* Link against MobileGestalt | |
*/ | |
OBJC_EXTERN CFStringRef MGCopyAnswer(CFStringRef property) WEAK_IMPORT_ATTRIBUTE; | |
void someFunction() { | |
CFStringRef udid = MGCopyAnswer(CFSTR("UniqueDeviceID")); | |
/* |
OlderNewer