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)isMobileNumber:(NSString *)mobileNum | |
{ | |
/** | |
* 手机号码 | |
* 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188 | |
* 联通:130,131,132,152,155,156,185,186 | |
* 电信:133,1349,153,180,189 | |
*/ | |
NSString * MOBILE = @"^1(3[0-9]|5[0-35-9]|8[025-9])\\d{8}$"; | |
/** |
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
source 'http://rubygems.org' | |
gem 'rails', '3.2.x' | |
# Gems used only for assets and not required | |
# in production environments by default. | |
group :assets do | |
gem 'sass-rails', "3.2.5" | |
gem 'coffee-rails', "3.2.2" | |
gem 'uglifier', '1.2.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
if (recognizer.state == UIGestureRecognizerStateEnded) { | |
CGPoint velocity = [recognizer velocityInView:self.view]; | |
CGFloat magnitude = sqrtf((velocity.x * velocity.x) + (velocity.y * velocity.y)); | |
CGFloat slideMult = magnitude / 200; | |
NSLog(@"magnitude: %f, slideMult: %f", magnitude, slideMult); | |
float slideFactor = 0.1 * slideMult; // Increase for more of a slide | |
CGPoint finalPoint = CGPointMake(recognizer.view.center.x + (velocity.x * slideFactor), | |
recognizer.view.center.y + (velocity.y * slideFactor)); |
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
CLLocationManager获取的坐标是由google坐标系得到的坐标,转化为百度坐标系百度有在官方API未公开实际存在的接口做转换。 | |
/** | |
*坐标转换函数,从原始GPS坐标,mapbar坐标转换成百度坐标 | |
*@param coorWgs84 待转换的原始GPS坐标,或者mapbar的坐标 | |
*@return 返回的NSDictionry中包含“x”,“y”字段,各自对应经过base64加密之后的x,y坐标 | |
*/ | |
UIKIT_EXTERN NSDictionary* BMKBaiduCoorForWgs84(CLLocationCoordinate2D coorWgs84); | |
/** | |
*坐标转换函数,从google坐标,51地图坐标,mapabc坐标转换为百度坐标(51地图坐标需要显出10000) |
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
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
import decimal | |
path1='/Users/liuchao/Desktop/hah.mp3' | |
paht2='/Users/liuchao/Desktop/EZ/EzRead.py' | |
def get_Relative_Path(path1,path2): |
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/bash | |
bangzhu (){ | |
cat << EOF | |
用法: `basename $0` 文件名 [书名] [作者] | |
其中文件名是必须的,书名、作者什么的可以不添加,书名默认为文件名。作者则留空。至于出版社什么的就都浮云了。其实修改也很简单,但是我不需要所以就从简了。 | |
EOF | |
} |
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
- (UIColor *) getPixelColorAtLocation:(CGPoint)point { | |
UIColor* color = nil; | |
CGImageRef inImage = self.image.CGImage; | |
// Create off screen bitmap context to draw the image into. Format ARGB is 4 bytes for each pixel: Alpa, Red, Green, Blue | |
CGContextRef cgctx = [self createARGBBitmapContextFromImage:inImage]; | |
if (cgctx == NULL) { | |
return nil; /* error */ | |
} | |
size_t w = CGImageGetWidth(inImage); |
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
#pragma mark -KeyBoard Notifications | |
-(void) registerForKeyBoardNotification{ | |
//键盘出现时发出信息 | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name:UIKeyboardWillShowNotification object:nil]; | |
//键盘消失时发出信息 | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; | |
} | |
//called when uikeyboarddidshownotification is sent. | |
-(void)keyboardWasShown:(NSNotification *)noti{ |
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 | |
projectfile=`find -d . -name 'project.pbxproj'` | |
projectdir=`echo *.xcodeproj` | |
projectfile="${projectdir}/project.pbxproj" | |
tempfile="${projectdir}/project.pbxproj.out" | |
savefile="${projectdir}/project.pbxproj.mergesave" | |
cat $projectfile | grep -v "<<<<<<< HEAD" | grep -v "=======" | grep -v "^>>>>>>> " > $tempfile | |
cp $projectfile $savefile |
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
NSString *fontPath = [[NSBundle mainBundle] pathForResource:_fontName ofType:@"otf"]; | |
CGDataProviderRef fontDataProvider = CGDataProviderCreateWithFilename([fontPath UTF8String]); | |
// 从DataProvider创建字体 | |
CGFontRef theCGFont =CGFontCreateWithDataProvider(fontDataProvider); | |
CTFontRef theCTFont=CTFontCreateWithGraphicsFont(theCGFont,_fontSize,NULL,NULL); | |
CFRelease(theCGFont); | |
CFRelease(fontDataProvider); | |
//创建AttributeString | |
attrString=[[NSMutableAttributedString alloc]initWithString:self.text]; | |
//设置字体及大小 |
NewerOlder