对于偏技术性的文章,用户更在意文章的更新时间而非发表时间

将如下代码添加到主题函数 function.php 文件中,如果你不会的话,推荐使用这个插件:Code Snippets

function wp_last_updated_date( $content ) {
$time = get_the_time('U');
$modified_time = get_the_modified_time('U');
$custom_content = '';
if ($modified_time >= $time + 86400) {
$updated_time = get_the_modified_time('Y-m-d H:i:s');
$custom_content .= '<p class="last-updated" style="color: #999;font-size: 12px;">文章最后更新于'. $updated_time .',如果失效请留言</p>';
}

$custom_content .= $content;
return $custom_content;
}
add_filter( 'the_content', 'wp_last_updated_date' );

插件介绍

Code Snippets 是一款可以简单、干净、安全添加 php 代码到你网站的插件,就跟直接写入 functions.php 文件里面的效果一样。

使用 Code Snippets 添加代码还有一个优点就是添加的代码不会因为你主题文件升级而丢失,而直接写入 functions.php 文件里面升级会被覆盖,还需要手动备份一次。

直接在后台搜索该插件安装即可

使用示例

添加 php 代码

直接新建一个 snippets 将 php 代码站填进去即可

添加 css 代码

add_action( 'wp_head', function () { ?>
<style>

/* write your CSS code here */

</style>
<?php } );

添加 js 代码

默认示例添加 js 代码使用的是 wp_head 函数,这里推荐使用 wp_footer,你可以根据 js 作用自行选择

// 在底部添加js代码,
add_action( 'wp_footer', function () { ?>
<script>

/* write your JavaScript code here */

</script>
<?php } );

vue-awesome-swiper: 基于 Swiper4、适用于 Vue 的轮播组件,支持服务端渲染和单页应用

github 地址:https://github.com/surmon-china/vue-awesome-swiper

官网:https://github.surmon.me/vue-awesome-swiper/

问题:

设置 loop:true, autoplay:2000 不会自动滚动

解决
在 swiper 上添加 v-if="swiperSlides.length>0"

<swiper v-if="swiperSlides.length>0" :options="swiperOption" ref="mySwiper">

monthOptions: {
color: ['#FFD058'], // 设置柱的颜色 会被 series itemStyle color 覆盖
xAxis: [
{
data: ['报备组数', '来访组数', '大定套数', '草签套数', '正签套数'], // x轴
axisLabel: {
inside: false, // 在外部显示
textStyle: { // 设置样式
color: 'rgba(255,255,255,0.5)',
fontSize: 15,
fontFamily: 'PingFang-SC-Regular,PingFang-SC'
}
},
axisTick: { show: false }, // x轴线上的分割点
axisLine: { show: false }// x轴线
}
],
yAxis: {
axisLine: { show: false },
axisTick: { show: false },
axisLabel: {
formatter: function () { return '' } // 去掉y轴显示数字
},
splitLine: { show: false } // 水平线
},
grid: { // 间距
left: '10%',
right: '10%',
bottom: '15%',
top: '15%',
containLabel: true
},
series: [
{ // 用于显示阴影
type: 'bar',
itemStyle: {
color: 'rgba(255,255,255,0.08)'
},
barGap: '-100%',
// barCategoryGap: '25%',
barWidth: '15%',
data: [1, 1, 1, 1, 1]
// animation: false
},
{ // 正常数据
name: '',
type: 'bar',
barWidth: '15%',
data: [],
itemStyle: { // 上方显示数值
normal: {
label: {
formatter: function (val) {
return formate(val.value)
},
show: true, // 开启显示
position: 'top', // 在上方显示
textStyle: { // 数值样式
color: '#FFD058',
fontSize: 15,
fontFamily: 'PingFang-SC-Regular,PingFang-SC'
}
}
}
}
}
],
animationDuration: 2000
}

修改线上页面内容

有时候调试网页,需要在第三方页面中注入点 js 或修改一些代码,来进行自己的测试,可以使用 FiddlerScript 修改页面内容

使用方法如下

打开 fiddler 选择右边的 FiddlerScript 选项卡,或者从菜单 - Rules(规则) - Customize Rules(自定义规则) 打开

点击 Go to(转到) - 选择 OnBeforeResponse 添加如下代码

static function OnBeforeResponse(oSession: Session) {
// ...
// 判断如果是百度或是请求url中包含 baidu.com 的响应就在head前面添加一个 js 弹窗
if (oSession.HostnameIs('www.baidu.com') || oSession.uriContains('baidu.com') && oSession.oResponse.headers.ExistsAndContains('Content-Type', 'text/html')) {
// 解码响应内容
oSession.utilDecodeResponse()
// 替换内容
oSession.utilReplaceInResponse('</head>', '<script>alert("哈哈");</script></head>')
}
}

如果要替换的内容比较多或比较复杂,可以使用正则替换,替换方式如下

// 解码响应内容
oSession.utilDecodeResponse()
var oBody = System.Text.Encoding.UTF8.GetString(oSession.responseBodyBytes)
// 使用正则进行替换
var oRegEx = /<\/head>/gi
oBody = oBody.replace(oRegEx, '<script>alert(1);</script></head>')
//设置新的响应内容
oSession.utilSetResponseBody(oBody)

最后点击左上角的 Save Script(保存) 即可

线上请求映射到本地开发环境

  1. 本地文件响应

编辑 FiddlerScript 添加如下代码

static function OnBeforeResponse(oSession: Session) {
// 如果请求 url 中包含 nav.js 就用 D:/nav.js 来响应
if (oSession.uriContains('nav.js')) {
oSession['x-replywithfile'] = 'D:/nav.js'
}
}

除了编辑 FiddlerScript,也可以选择在右侧打开 AutoResponder(自动回复器) 选项卡(参考第三点) ,添加规则并启用规则,效果相同

  1. 本地目录响应

原理同响应单个文件,只是封装了方法批量替换

static function OnBeforeResponse(oSession: Session) {
if (m_Hide304s && oSession.responseCode == 304) {
oSession['ui-hide'] = 'true'
}

var domain: String = 'http://online.com/static/'
// 本地目录 注意使用 '/' 代替 '\'
var folder: String = 'D:/static/'
AutoResponseFolder(oSession, domain, folder)
}

static function AutoResponseFolder (oSession: Session, domain: String, folder: String) {
// 获取当前对话的完整URL
var fullUrl: String = oSession.fullUrl
if (fullUrl.StartsWith(domain)) {
var localPath: String = fullUrl.replace(domain, folder)
// 设置延迟
// oSession['response-trickle-delay'] = 1000
oSession['x-replywithfile'] = localPath
// FiddlerObject.log(localPath)
}
}
  1. 替换整个线上环境为本地开发环境

例如将所有 http://online.com 上的请求替换成本地 localhost,可以做如下:

AutoResponder(自动回复器) 选项卡中,添加如下规则:regex:(?insx)http://online.com\/(?<name>.+)$ => http://localhost/${name}

  1. 使用 Stave 插件批量映射

下载地址:https://code.google.com/archive/p/stave/downloads

网站建立的时间久了,有时候删除过期的文章,会造成链接无法正常访问,或者网站使用了图床,图片不能正常访问等。如果一个网站存在大量死链接,会严重影响用户的正常浏览,也影响搜索引擎爬取网站,对网站优化排名不利

Xenu 是一款出色的网站死链接检测工具,检测网页中的链接、图片、js、css 等是否存在损坏的链接

xenu 下载 http://home.snafu.de/tilman/xenulink.html

假设旧域名是 a.com,新域名为 b.com,修改数据库 sql 如下

UPDATE wp_options SET option_value = REPLACE(option_value, 'http://a.com', 'http://b.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://a.com', 'http://b.com');

UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://a.com','http://b.com');

UPDATE wp_comments SET comment_content = REPLACE (comment_content, 'http://a.com', 'http://b.com');

UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 'http://a.com', 'http://b.com');

UPDATE wp_posts SET guid = REPLACE (guid, 'http://a.com', 'http://b.com') WHERE post_type = 'attachment';

axios/index.js 部分配置如下

// axios/index.js
import axios from 'axios'
const Axios = axios.create({
// ...
})

原因:

axios 实例没有 all 这个方法,all 是 axios 的静态方法

所以解决方式就是将该方法手动挂载到 Axios 实例上即可

axios/index.js 添加如下配置

// axios/index.js
import axios from 'axios'
const Axios = axios.create({
// ...
})
+ Axios.all = axios.all
+ Axios.spread = axios.spread

附 axios 并发多个请求方式:

function request1 () {
return axios.get('/user/12345')
}

function request2 () {
return axios.get('/user/12345/permissions')
}

axios.all([request1(), request2()])
.then(axios.spread((res1, res2) => {
// 两个请求现在都执行完成
// acct、perms 分别为两个请求的结果
}))

tldr
快速查看命令的使用示例

安装

npm i -g tldr

使用

# 查看git的使用示例
tldr git

thefuck
快速修正命令行手误

Internet Download Manager (简称 IDM) 是 Windows 平台老牌而功能强大的多线程下载工具,支持多媒体下载、自动捕获链接、自动识别文件名、静默下载、批量下载、计划下载任务、站点抓取、队列,支持 IE, Opera, Firefox, Chrome 等所有流行的浏览器,如果启用高级集成,则可以捕获和接管从任何程序的下载。

安装说明

下载完成后解压,运行安装程序,安装完就是注册版

配合插件使用

谷歌浏览器插件安装方法:找到你的 IMD 安装目录 注意是安装好后 找到 IDMGCExt.crx IDMGCExt59.crx2 个文件,
选择 IDMGCExt.crx 拖动到谷歌浏览器,如果装不上选择 IDMGCExt59.crx 能装上!

提醒:某些网盘无法使用 IDM 下载的解决办法:下载时,按住 Alt 键,再点击下载按钮就不会调用 IDM 了!

有能力的建议支持正版

破解版下载地址

百度网盘:https://pan.baidu.com/s/1NQmnqEGAfCu416zCwX-ATA 提取码:wqdy
阿里云盘:https://www.aliyundrive.com/s/BrLj3RAXJ3v 提取码:f99y
TG:https://t.me/wqdy_channel/36