Skip to content

Instantly share code, notes, and snippets.

@shangdev
shangdev / aws s3 cli
Created July 21, 2017 20:48
aws s3 cli 记录
1.cp 文件到s3,并设置为public权限:
aws s3 cp images s3://adwords.yeahmobi.com/wp-content/themes/hanrm-cn/assets/images --recursive --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
2.递归删除s3上目录下的所以文件:
aws s3 rm --recursive s3://adwords.yeahmobi.com/wp-content/themes/hanrm-cn/assets/images/
3.列出s3某个目录下的所以文件:
aws s3 ls s3://adwords.yeahmobi.com/wp-content/
@shangdev
shangdev / wordpress, robots.txt 未上线
Last active July 31, 2017 11:41
wordpress, robots.txt
/**
* robots.txt
*
* @param string $output The output of the robots.txt file
* @return string $public If the site is public facing
*/
function robots_mod( $output, $public ) {
$output .= "Disallow: /\n";
return $output;
/**
* robots.txt
*
* @param string $output The output of the robots.txt file
* @return string $public If the site is public facing
*/
function robots_mod( $output, $public ) {
$output .= "Disallow: /wp-includes/\n";
$output .= "Disallow: /wp-content/plugins/\n";
$output .= "Allow: /\n";
@shangdev
shangdev / Google Map API 移动友好处理
Created July 31, 2017 16:59
Google Map API 移动友好处理
官方文档:https://developers.google.com/maps/documentation/javascript/interaction?hl=zh-cn
<script>
/**
* Google Map
*/
function initMap() {
var uluru = {lat: 34.318877, lng: 108.948488};
var map = new google.maps.Map(document.getElementById('c_map'), {
center: uluru,
@shangdev
shangdev / Change Import Jquery.js method
Created August 3, 2017 12:30
Change Import Jquery.js method
//Making jQuery Google API
function modify_jquery() {
if (!is_admin()) {
// comment out the next two lines to load the local copy of jQuery
wp_deregister_script('jquery');
}
}
add_action('init', 'modify_jquery');
@shangdev
shangdev / Delete Default Jquery
Created August 5, 2017 10:44
Wordpress:function.php写入取消默认Jquery的引入
// Delete System Jquery
function delete_jquery() {
if ( is_admin() ) return;
wp_deregister_script('jquery');
}
add_action('wp_enqueue_scripts', 'delete_jquery');
@shangdev
shangdev / paginate_links
Created September 23, 2017 16:56
WP_Query 中 paginate_links 的使用。
@shangdev
shangdev / the_posts_pagination
Created September 23, 2017 17:01
归档页分页函数 the_posts_pagination 的使用
/**
* The pagenation
* @info 每页显示数量设置:设置->阅读->博客页面至多显示
*/
the_posts_pagination( array(
'prev_text' => '«',
'next_text' => '»',
) )
proxy_cache_path /var/nginx/cache/aws/trueniu levels=2:2:2 use_temp_path=off keys_zone=aws_3:500m inactive=30d max_size=10g;
server {
listen 80;
server_name trueniu.com www.trueniu.com;
if ( $scheme = http ) {
return 301 https://www.trueniu.com$request_uri;
}
}
@shangdev
shangdev / Nginx install and Add-module
Last active November 17, 2017 06:30
Nginx install and Add-module in centos
############################
## 安装Nginx
############################
首先安装必要的库(nginx 中gzip模块需要 zlib 库,rewrite模块需要 pcre 库,ssl 功能需要openssl库)。选定/usr/local为安装目录,以下具体版本号根据实际改变。
1.安装PCRE库
$ cd /usr/local/
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
$ tar -zxvf pcre-8.38.tar.gz
$ cd pcre-8.38