This file contains 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
$pattern = "/height=\"[0-9]*\"/"; | |
$content = preg_replace($pattern, "", $content); | |
$pattern = "/width=\"[0-9]*\"/"; | |
$content = preg_replace($pattern, 'width="600"', $content); |
This file contains 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
//php获取文件扩展名 | |
function getExt($url) | |
{ | |
$path=parse_url($url); | |
$str=explode('.',$path['path']); | |
return $str[1]; | |
} |
This file contains 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
sudo -s | |
nginx=stable # use nginx=development for latest development version | |
add-apt-repository ppa:nginx/$nginx | |
apt-get update | |
apt-get install nginx |
This file contains 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) validateEmail:(NSString *)email | |
{ | |
NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"; | |
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex]; | |
return [emailTest evaluateWithObject:email]; | |
} | |
//手机号码验证 |
This file contains 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 | |
# Pick a uuid for the app (or reuse existing one). | |
if ! [ -f installApp.uuid ]; then | |
uuidgen > installApp.uuid | |
fi | |
UUID=$(cat installApp.uuid) | |
#create supporting folders | |
TOPDIR="/Users/Apple/Library/Application Support/iPhone Simulator/7.0/Applications/$UUID/" | |
mkdir -p "$TOPDIR" | |
mkdir -p "$TOPDIR/Documents" |
This file contains 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 *)createNonInterpolatedUIImageFormCIImage:(CIImage *)image withSize:(CGFloat) size { | |
CGRect extent = CGRectIntegral(image.extent); | |
CGFloat scale = MIN(size/CGRectGetWidth(extent), size/CGRectGetHeight(extent)); | |
// Since CoreImage nicely interpolates, we need to create a bitmap image that we'll draw into | |
// a bitmap context at the desired size; | |
size_t width = CGRectGetWidth(extent) * scale; | |
size_t height = CGRectGetHeight(extent) * scale; | |
CGColorSpaceRef cs = CGColorSpaceCreateDeviceGray(); | |
CGContextRef bitmapRef = CGBitmapContextCreate(nil, width, height, 8, 0, cs, (CGBitmapInfo)kCGImageAlphaNone); | |
CIContext *context = [CIContext contextWithOptions:nil]; |
This file contains 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
<?php | |
define( "ROOTPATH", "../../" ); | |
include( ROOTPATH."includes/admin.inc.php" ); | |
include( "language/".$sLan.".php" ); | |
include( ROOTPATH."includes/data.inc.php" ); | |
$act = $_POST['act']; | |
switch ( $act ) | |
{ | |
case "getbordertemplist" : | |
needauth( 5 ); |
This file contains 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
sudo -i | |
cd /etc/apt/sources.list.d | |
echo "deb http://archive.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list | |
apt-get update | |
apt-get install ia32-libs | |
rm /ia32-libs-raring.list | |
apt-get update | |
exit |
This file contains 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
#在 Mac 上打开 Terminal 输入如下命令并替换 /path/ 为目标路径,即可修改截屏路径。 | |
defaults write com.apple.screencapture location /path/ | |
#运行上一条后还需要在 Terminal 输入下述命令,才能让新路径生效: | |
killall SystemUIServer |
This file contains 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
UIButton *clearButton = [myTextField valueForKey:@"_clearButton"]; | |
[clearButton setImage:[UIImage new] forState:UIControlStateNormal]; |