推荐阅读
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>无标题文档</title> | |
<style> | |
*{margin:0;padding:0;} | |
body{margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;color:#333;height:1000px;} | |
a{color:#08c;text-decoration:none;} | |
a:hover,a:focus{color:#005580;text-decoration:underline;cursor:pointer;} |
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
/*NEW NAVIGATOR START*/ | |
function hasClass(ele,cls) { | |
return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)')); | |
} | |
function addClass(ele,cls) { | |
if (!this.hasClass(ele,cls)) ele.className += " "+cls; | |
} | |
function removeClass(ele,cls) { |
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 | |
//一个很大的二维数组 | |
$arr = array( | |
0 => array( | |
'id'=>11, | |
'name'=>'name1' | |
), | |
1 => array( | |
'id'=>22, | |
'name'=>'name2' |
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
<!DOCTYPE html> <!-- HTML5 doctype 不区分大小写 --> | |
<html lang="zh-cmn-Hans-CN"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa --> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <!-- 优先使用IE最新版本和 Chrome --> | |
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <!-- 360 浏览器内核控制 --> | |
<!-- | |
content的取值为webkit,ie-comp,ie-stand之一,区分大小写,分别代表用webkit内核,IE兼容内核,IE标准内核。 |
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 | |
class ChatMemcache { | |
public $memcache; | |
public function __construct() { | |
$this->memcache = new Memcache; | |
$this->memcache->connect( CHAT_MEMCACHE_HOST, CHAT_MEMCACHE_PORT ); | |
} | |
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 | |
$cache = new Memcached(); | |
$cache->addServer('servername', 11211); | |
$myCacheKey = 'my_cache_key'; | |
$row = $cache->get($myCacheKey); |
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
# ########################################### | |
# 索引相关 | |
# ########################################### | |
– 查询(或更新,删除,可以转换为查询)没有用到索引 | |
这是最基础的步骤,需要对sql执行explain查看执行计划中是否用到了索引,需要重点关注type=ALL, key=NULL的字段。 | |
– 在索引字段上施加函数 | |
to_char(gmt_created, ‘mmdd’) = ’0101′ | |
正确的写法 | |
gmt_created between to_date(“20090101″, “yyyymmdd”) and to_date(“20090102″, “yyyymmdd”) | |
– 在索引字段上使用全模糊 |
This gist assumes:
- you have a local git repo
- with an online remote repository (github / bitbucket etc)
- and a cloud server (Rackspace cloud / Amazon EC2 etc)
- your (PHP) scripts are served from /var/www/html/
- your webpages are executed by apache
- apache's home directory is /var/www/
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
<? | |
$html=@$_GET['html']; | |
if(get_magic_quotes_gpc()) | |
$html = stripslashes($html); | |
if(!$html) | |
$html='<h1>No Text</h1><hr/><p>You did not give a html parameter to show:<br /><b>...painty.php?html=...</b></p><p><img src="http://static.php.net/www.php.net/images/php.gif" /></p>'; | |
$config = array | |
( | |
'input' => $html, | |
'output' => "png", |