Skip to content

Instantly share code, notes, and snippets.

View weekwood's full-sized avatar
🎯
Focusing

Di Wu weekwood

🎯
Focusing
View GitHub Profile
{
"type": "success",
"data": {
"id": "3cdcd5b0-d1b9-11e7-aeee-07c46f347778",
"plate": "浙H19800",
"plate_type": null,
"brand": null,
"category": null,
"model": "H02",
"province": null,
extension UIView {
@discardableResult
func fromNib<T : UIView>() -> T? {
guard let view = Bundle.main.loadNibNamed(String(describing: type(of: self)), owner: self, options: nil)?[0] as? T else {
return nil
}
return view
}
}
//
// NSURL+YZThumbnail.m
// YuanZi
//
// Created by di wu on 5/4/15.
// Copyright (c) 2015 Yuanzi. All rights reserved.
//
#import "NSURL+YZThumbnail.h"
{
"createdAt": "2015-06-16T09:10:40.274Z",
"readStatus": false,
"noticeType": "systemNotice",//系统消息
"system": [//系统消息
{
"noticeMaster": {
"nickname": "admin",
"baby": {
"gender": "n",
{
data={
cards=({
"_id"=549f70766b0760c934a07df2;"comment_count"=2;cover="http://img.iyuanzi.net/cardCover/2014-12/b23ebe43-27b1-4941-8838-aa2ce9691d34";"create_at"="1\U4e2a\U6708\U524d";description="";"favorite_count"=4;id=549f70766b0760c934a07df2;index=0;isFavorited=0;isPraised=0;isTop=1;owner={
"_id"=549d1d2e566d41e412eef816;avatar="http://img.iyuanzi.net/userAvatar/2014-12/d5cb4c03-10ff-45d2-adbd-5871e724898e";id=549d1d2e566d41e412eef816;"nick_name"="\U852c\U83dc\U5988\U5988";
};"praise_count"=10;"shared_count"=4;title="\U7ed9\U7238\U7238\U7684\U543b";"update_at"="16\U5929\U524d";
},
{
"_id"=549f70736b0760c934a07dec;"comment_count"=4;cover="http://img.iyuanzi.net/cardCover/2014-12/8657281e-978f-470f-92c0-7f7a8ab926fb";"create_at"="1\U4e2a\U6708\U524d";description="";"favorite_count"=2;id=549f70736b0760c934a07dec;index=0;isFavorited=0;isPraised=0;isTop=1;owner={
"_id"=549d1d2e566d41e412eef816;avatar="http://img.iyuanzi.net/userAvatar/2014-12/d5cb4c03-10ff-45d2-adbd-5871e724898e";id=
static NSDictionary *titleMapping = nil;
if (!titleMapping) {
NSString *(^const format)(NSUInteger, NSString *, NSString *) = ^(NSUInteger value, NSString *singular, NSString *plural) {
return [NSString stringWithFormat:@"%d %@", value, (value == 1 ? singular : plural)];
};
titleMapping = @{
@"Scratches" : ^(MyClass *target) {
return format([target numberOfScratches], @"Scratch", @"Scratches");
},
_MimeTypes = @{
@"text/plain": @{ @"icon": @"txt-big", @"ext" : @[@"txt", @"text", @"conf", @"def", @"log", @"list", @"ini"] },
@"text/css": @{ @"icon": @"css-big", @"ext" : @[@"css"] },
@"text/javascript": @{ @"icon": @"js-big", @"ext" : @[@"js"] },
@"text/html": @{ @"icon": @"ie-big", @"ext" : @[@"html", @"htm"] },
@"text/xml": @{ @"icon": @"xml-big", @"ext" : @[@"xml", @"xsl", @"xslt"] },
@"text/csv": @{ @"icon": @"csv-big", @"ext" : @[@"csv"] },
@"text/x-vcard": @{ @"icon": @"vcf-big", @"ext" : @[@"vcf"] },
@"text/calendar":
@weekwood
weekwood / thumbnail.m
Last active August 29, 2015 14:09
AVURLAsset Thumbnail
AVURLAsset *asset1 = [[AVURLAsset alloc] initWithURL:[info objectForKey:@"UIImagePickerControllerMediaURL"] options:nil];
AVAssetImageGenerator *generate1 = [[AVAssetImageGenerator alloc] initWithAsset:asset1];
generate1.appliesPreferredTrackTransform = YES;
NSError *err = NULL;
CMTime time = CMTimeMake(1, 2);
CGImageRef oneRef = [generate1 copyCGImageAtTime:time actualTime:NULL error:&err];
UIImage *one = [[UIImage alloc] initWithCGImage:oneRef];
NSMutableArray *resultArray = [NSMutableArray new];
NSArray *groups = [self.survey.questions valueForKeyPath:@"@distinctUnionOfObjects.type"];
for (NSString *groupId in groups)
{
NSMutableDictionary *entry = [NSMutableDictionary new];
[entry setObject:groupId forKey:@"type"];
NSArray *groupNames = [self.survey.questions filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"type = %@", groupId]];
[entry setObject:groupNames forKey:@"values"];
{ "channel" : 1,
"content" : "우리 주변의 다양한 사람들의 삶을 진솔하게 보여주는 다큐멘터리로 2001년 2월 13일에 첫 방송을 시작해서 월요일부터 금요일까지 매일 방송을 하고 있는 장수 프로그램이다. 다양한 사람들의 매우 진솔한 모습을 담아내는 것이 특징이다. 《인간극장》은 매주 월 ~ 금 아침 7시 50분에서 8시 25분까지 KBS 제1TV에서 방송되고 있는 텔레비전 프로그램이다. 2000년 5월 1일에 방송을 시작하여 현재까지 방송되고 있다.",
"cover_img" : "http://tv1009.anydev.net/uploads/tv_info/2013072410074133367.jpg",
"create_time" : "2013-07-17 18:53:56",
"hit" : 2040,
"hour_minute" : 28200,
"id" : 472,
"is_over" : 0,
"last_term" : "20140327",
"last_update" : 1395923383,