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
// 判断是否为整形: | |
- (BOOL)isPureInt:(NSString *)string { | |
NSScanner *scan = [NSScanner scannerWithString:string]; | |
int val; | |
return [scan scanInt:&val] && [scan isAtEnd]; | |
} | |
// 判断是否为浮点形: | |
- (BOOL)isPureFloat:(NSString *)string { |
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
//依赖包CoreLocation.framework, MobileCoreServices.framework, SystemConfiguration.framework, Security.framework | |
#import "AFNetworking.h" | |
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; | |
//默认是AFJSONRequestSerializer | |
manager.responseSerializer = [AFHTTPResponseSerializer serializer]; | |
[manager GET:@"http://www.baidu.com" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { | |
NSData *data = (NSData *)responseObject; |
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 "CommonCrypto/CommonDigest.h" | |
-(NSString*) sha1:(NSString*)input | |
{ | |
const char *cstr = [input cStringUsingEncoding:NSUTF8StringEncoding]; | |
NSData *data = [NSData dataWithBytes:cstr length:input.length]; | |
uint8_t digest[CC_SHA1_DIGEST_LENGTH]; | |
CC_SHA1(data.bytes, data.length, digest); |
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
package com.terrynow.common; | |
import java.security.MessageDigest; | |
import java.security.NoSuchAlgorithmException; | |
/** | |
* Developer: Terry DateTime : 2007-12-18 下午03:36:22 | |
*/ | |
public class HashUtils { |
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 "UIColor+PXExtensions.h" | |
@implementation UIColor (UIColor_PXExtensions) | |
+ (UIColor*)pxColorWithHexValue:(NSString*)hexValue | |
{ | |
//Default | |
UIColor *defaultResult = [UIColor blackColor]; | |
//Strip prefixed # hash |
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、调用 自带mail | |
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"mailto://[email protected]"]]; | |
//2、调用 电话phone | |
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"tel://8008808888"]]; | |
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
#upname.sql 脚本: | |
DELIMITER // | |
DROP PROCEDURE IF EXISTS uppercase // | |
CREATE PROCEDURE uppercase(IN dbname VARCHAR(200)) | |
BEGIN | |
DECLARE done INT DEFAULT 0; |
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
//http://blog.csdn.net/wilmer_wu/article/details/6974402 | |
//谈谈iOS下视图、坐标、位置相关等基础概念 | |
CGRect mainBounds = [UIScreen mainScreen].bounds; | |
int height = mainBounds.size.height; | |
self.btn.center = CGPointMake(mainBounds.size.width/2, mainBounds.size.height/2); // set center | |
CGRect frame = self.btn.frame; | |
self.btn.frame = CGRectMake( frame.origin.x, height-frame.size.height, frame.size.width, frame.size.height ); // set new position exactly |
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
/** | |
* 转换图片成圆形 | |
* | |
* @param bitmap | |
* 传入Bitmap对象 | |
* @return | |
*/ | |
public static Bitmap toRoundBitmap(Bitmap bitmap) { | |
if (bitmap == null) | |
return null; |
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
// | |
// UserConext.m | |
// HelloWorld | |
// | |
// Created by Terry on 2013-10-07. | |
// Copyright (c) 2013 Terry. All rights reserved. | |
// | |
#import "UserConext.h" |