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 to get all x,y coords of specified rgb color | |
4 arguments: path/to/image, and red, green, blue values | |
of target pixel to search for. function assumes $pic | |
to be a .jpg type image. You will have to change the | |
code if you are using a different image type, or else | |
setup some conditions to determine which image type | |
$pic is, and use the proper GD functions for it. | |
$r, $g, $b each takes a 0-255 dec format value. |
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 | |
/** | |
* | |
* 相似图片æœç´¢hashçš„php实现 | |
* @author welefen | |
* | |
*/ | |
class Imghash{ | |
private static $_instance = null; |
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 | |
/* | |
* File: SimpleImage.php | |
* Author: Simon Jarvis | |
* Modified by: Miguel Fermín | |
* Based in: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php | |
* | |
* This program is free software; you can redistribute it and/or | |
* modify it under the terms of the GNU General Public License | |
* as published by the Free Software Foundation; either version 2 |
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
http://sourceforge.net/projects/snoopy/ |
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
------------------------- 前端 | |
/** | |
* 前端公共函数方法整理 | |
* @author Weige | |
* 备注: 配合jqury.js 使用 | |
* 2012-04 | |
*/ | |
//获取字符串长度 | |
function getWordSize(str) |
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
function ValidateAddress($address) { | |
if (defined('PCRE_VERSION')) { //Check this instead of extension_loaded so it works when that function is disabled | |
if (version_compare(PCRE_VERSION, '8.0') >= 0) { | |
return (boolean)preg_match('/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', $address); | |
} |
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
//This is how HTML, Controller & Directive looked in my actual app at this point. | |
//Notice that we are applying masonry for every element as they are added by ng-repeat. | |
//HTML | |
/* | |
<div id="photoContainer" style="position:relative;height:800px;zoom:1;"> | |
<div class="photo" ng-repeat="photoPost in photoPosts"> | |
<img ng-src="{{photoPost.photo.url}}" add-masonry="photoPost"></div> | |
</div> | |
</div> |
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
function loadModel($type, $id, $errorMessage='This page does not exist', $errorNum=404) | |
{ | |
$model = CActiveRecord::model($type)->findByPk($id); | |
if ($model === null) | |
throw new CHttpException($errorNum, $errorMessage); | |
return $model; | |
} |
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
#include <pthread.h> | |
#include <stdio.h> | |
#include <sys/time.h> | |
#include <string.h> | |
#define MAX 100000000 | |
pthread_t thread[2]; | |
pthread_mutex_t mut; | |
void *thread1() | |
{ |
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
echo '================================================='; | |
echo 'Enter master'; | |
echo '================================================='; | |
git checkout master | |
echo '================================================='; | |
echo 'Merging dev branch commits'; | |
echo '================================================='; | |
git merge mini_dev --no-ff |
OlderNewer