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
function get_post_excerpt($post, $excerpt_length=240){ | |
if(!$post) $post = get_post(); | |
$post_excerpt = $post->post_excerpt; | |
if($post_excerpt == ''){ | |
$post_content = $post->post_content; | |
$post_content = do_shortcode($post_content); | |
$post_content = wp_strip_all_tags( $post_content ); | |
$post_excerpt = mb_strimwidth($post_content,0,$excerpt_length,'…','utf-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
#!/usr/local/bin/php -q | |
<?php | |
error_reporting(E_ALL); | |
/* Allow the script to hang around waiting for connections. */ | |
set_time_limit(0); | |
/* Turn on implicit output flushing so we see what we're getting | |
* as it comes in. */ | |
ob_implicit_flush(); |
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
document.getElementById("rte").focus(); | |
document.body.addEventListener("paste", function(e) { | |
for (var i = 0; i < e.clipboardData.items.length; i++) { | |
if (e.clipboardData.items[i].kind == "file" && e.clipboardData.items[i].type == "image/png") { | |
// get the blob | |
var imageFile = e.clipboardData.items[i].getAsFile(); | |
// read the blob as a data URL | |
var fileReader = new FileReader(); | |
fileReader.onloadend = function(e) { |
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
/* lets try a lighter blue... */ | |
html { | |
-webkit-tap-highlight-color: rgba(201, 224, 253, 0.8); | |
} | |
/* for some buttons or links, simply hide the selection color all together */ | |
.no-highlight { | |
-webkit-tap-highlight-color: rgba(0, 0, 0, 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
function isUrl(s) { | |
var regexp = /((http|https):\/\/)?[A-Za-z0-9\.-]{3,}\.[A-Za-z]{2}/; | |
return s.indexOf(' ') < 0 && regexp.test(s); | |
} | |
isUrl('http://baidu.com/') |
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
<?php | |
$proxy = stream_context_create(array( | |
'http' => array( | |
'timeout' => 5, | |
'proxy' => 'tcp://proxy.domain.com:8080', | |
'request_fulluri' => True, | |
) | |
)); | |
$page = file_get_contents('http://www.baidu.com/', false, $proxy); | |
echo($page); |
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
// 判断是否IE | |
function isMSIE(){ | |
var match = /(msie) ([\w.]+)/.exec( navigator.userAgent.toLowerCase() ); | |
if(match !== null){ | |
return true; | |
}else{ | |
return false; | |
} | |
} |
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
<!-- | |
高版本浏览器可以直接使用table-cell配合vertical-align来实现垂直居中。 | |
IE6\7则需要多一个容器,调整定位来实现 | |
--> | |
<style> | |
.wrap{ | |
width:500px;height:300px;border:3px solid #ddd;margin:0 auto;padding:20px;display:table; | |
*position:relative; | |
} |
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
/* | |
* background-attachment: fixed必须有,保证浏览器完整渲染背景图 | |
*/ | |
html { | |
background: url(images/perfect-full-page-bg.jpg) no-repeat center center fixed; | |
-webkit-background-size: cover; | |
-moz-background-size: cover; | |
-o-background-size: cover; | |
background-size: cover; | |
} |
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
Proxifier工具 |