__attribute__((overloadable)) NSString *descriptionFromValue(float value) {
return @(value).stringValue;
}
__attribute__((overloadable)) NSString *descriptionFromValue(NSRange range) {
return NSStringFromRange(range);
}
__attribute__((overloadable)) NSString *descriptionFromValue(id object) {
return [object description];
}
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
import android.text.TextUtils; | |
import android.util.Log; | |
/** | |
* Created by zorro on 14-10-16. | |
*/ | |
public class LogUtils { | |
public static final int VERBOSE = 1; | |
public static final int DEBUG = 2; | |
public static final int INFO = 3; |
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
#define NEED_DEBUG | |
#ifdef NEED_DEBUG | |
#define NSLog(format, ...) \ | |
do { \ | |
NSLog(@"<%@ : %d : %s>-%@", \ | |
[[NSString stringWithUTF8String:__FILE__] lastPathComponent], \ | |
__LINE__, \ | |
__FUNCTION__, \ |
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
UIImage *image = [UIImage imageNamed:@"a"]; | |
NSData *imgData = UIImageJPEGRepresentation(image, 1.0); | |
NSString *url = @"http://120.24.247.190/RCPR/detect_landmark"; | |
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; | |
//Very important!!! | |
manager.responseSerializer.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"text/html", nil]; | |
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
#!/bin/sh | |
# | |
# nginx - this script starts and stops the nginx daemin | |
# | |
# chkconfig: - 85 15 | |
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ | |
# proxy and IMAP/POP3 proxy server | |
# processname: nginx | |
# config: /etc/nginx/nginx.conf | |
# pidfile: /var/run/nginx.pid |
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
/* | |
// DEMO | |
int main(int argc, const char *argv[]) { | |
@autoreleasepool { | |
// JSON到Entity | |
UserEntity *userEntity = [UserEntity new]; | |
// 检查属性,设置默认值。 | |
checkEntity(userEntity); | |
NSLog(@"%@", userEntity); |
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
// | |
// main.m | |
// OC-Test1 | |
// | |
// Created by zorro on 14-7-23. | |
// Copyright (c) 2014年 zorro. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <objc/runtime.h> |
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
/* | |
* This is an example provided by Facebook are for non-commercial testing and | |
* evaluation purposes only. | |
* | |
* Facebook reserves all rights not expressly granted. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL | |
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |