分类 笔记 下的文章

vue+ueditor 双向绑定

来源:https://github.com/HaoChuan9421/vue-ueditor-wrap

安装:
npm i vue-ueditor-wrap

或者

yarn add vue-ueditor-wrap

下载:
https://github.com/HaoChuan9421/vue-ueditor-wrap/tree/master/assets/downloads

解压并命名为UEditor放到项目static目录下(vue-cli 3.x,可以把 UEditor 放入项目的public/static

引入:
import VueUeditorWrap from 'vue-ueditor-wrap'

注册:
components: {
VueUeditorWrap
}

使用:

<vue-ueditor-wrap v-model="msg" :config="myConfig"></vue-ueditor-wrap>
data () {
  return {
    msg: '<h2><img src="http://img.baidu.com/hi/jx2/j_0003.gif"/>Vue + UEditor + v-model双向绑定</h2>',
    myConfig: {
      // 编辑器不自动被内容撑高
      autoHeightEnabled: false,
      // 初始容器高度
      initialFrameHeight: 240,
      // 初始容器宽度
      initialFrameWidth: '100%',
      // 上传文件接口(这个地址是我为了方便各位体验文件上传功能搭建的临时接口,请勿在生产环境使用!!!)
      serverUrl: 'http://35.201.165.105:8000/controller.php',
      // UEditor 资源文件的存放路径,如果你使用的是 vue-cli 生成的项目,通常不需要设置该选项,vue-ueditor-wrap 会自动处理常见的情况,如果需要特殊配置,参考下方的常见问题2
      UEDITOR_HOME_URL: '/static/UEditor/'
    }
  }
}

localStorage 存储对象

存:
var obj = {"name":"hello","age":"16"}
localStorage.setItem("userInfo",JSON.stringify(obj));

取:
var user = JSON.parse(localStorage.getItem("userInfo"));

删:
localStorage.removeItem("userInfo");

清:
localStorage.clear();

批量更改文件名大写改为小写

@echo off
title 更改文件名大写为小写
::本代码原思路由yyykkkyyyy提供,依梦琴瑶修改并添加子目录的文件处理
::https://zhidao.baidu.com/question/368123497755817644.html
::再次感谢yyykkkyyyy,我这里就借花献佛了。
set dir=%~dp0&call:cdto
for /f "delims=" %%i in ('dir/s/b/ad') do set dir=%%i&call:cdto
pause
exit/b
:cdto
cd /d %dir%
for /f "delims=" %%i in ('dir/b/a-d/l') do ren "%%i" "%%i"

PHP获取指定N个工作日后日期

<?php
// 制定允许其他域名访问
header('Access-Control-Allow-Origin:*');
// 响应类型
header('Access-Control-Allow-Methods:*');
//请求头
header('Access-Control-Allow-Headers:*');
// 响应头设置
header('Access-Control-Allow-Credentials:false');

//节假日 需要手动维护配置文件或者放入db中
$holiday=['2019-01-01', '2019-01-05', '2019-01-06', '2019-01-12', '2019-01-13', '2019-01-19', '2019-01-20', '2019-01-26', '2019-01-27', '2019-02-04', '2019-02-05', '2019-02-06', '2019-02-07', '2019-02-08', '2019-02-09', '2019-02-10', '2019-02-16', '2019-02-17', '2019-02-23', '2019-02-24', '2019-03-02', '2019-03-03', '2019-03-09', '2019-03-10', '2019-03-16', '2019-03-17', '2019-03-23', '2019-03-24', '2019-03-30', '2019-03-31', '2019-04-05', '2019-04-06', '2019-04-07', '2019-04-13', '2019-04-14', '2019-04-20', '2019-04-21', '2019-04-27', '2019-05-01', '2019-05-02', '2019-05-03', '2019-05-04', '2019-05-11', '2019-05-12', '2019-05-18', '2019-05-19', '2019-05-25', '2019-05-26', '2019-06-01', '2019-06-02', '2019-06-07', '2019-06-08', '2019-06-09', '2019-06-15', '2019-06-16', '2019-06-22', '2019-06-23', '2019-06-29', '2019-06-30', '2019-07-06', '2019-07-07', '2019-07-13', '2019-07-14', '2019-07-20', '2019-07-21', '2019-07-27', '2019-07-28', '2019-08-03', '2019-08-04', '2019-08-10', '2019-08-11', '2019-08-17', '2019-08-18', '2019-08-24', '2019-08-25', '2019-08-31', '2019-09-01', '2019-09-07', '2019-09-08', '2019-09-13', '2019-09-14', '2019-09-15', '2019-09-21', '2019-09-22', '2019-09-28', '2019-10-01', '2019-10-02', '2019-10-03', '2019-10-04', '2019-10-05', '2019-10-06', '2019-10-07', '2019-10-13', '2019-10-19', '2019-10-20', '2019-10-26', '2019-10-27', '2019-11-02', '2019-11-03', '2019-11-09', '2019-11-10', '2019-11-16', '2019-11-17', '2019-11-23', '2019-11-24', '2019-11-30', '2019-12-01', '2019-12-07', '2019-12-08', '2019-12-14', '2019-12-15', '2019-12-21', '2019-12-22', '2019-12-28', '2019-12-29'];

function afterWorkDay($start_timestamp='',$add_workday_num='',$holiday=[]){
    //实际工作时间数组
    $workday=array();
    $i=0;
    //判断实际工作时间数组的长度
    while(count($workday)<intval($add_workday_num)){
        $i++;
        $onewdate=date('Y-m-d',($start_timestamp)+$i*(60*60*24));
        //非节假日添加实际工作时间数组
        if(!in_array($onewdate,$holiday)){
            $workday[]=$onewdate;
        }
    }
    return date('Y-m-d',($start_timestamp)+$i*(60*60*24));
}

$day = $_GET['day'];
$date = $_GET['date'];
$day = (int)$day - 1;
$start_time=strtotime($date);
//计算N个工作日后的时间 $N-1对应共N天
echo afterWorkDay($start_time,$day,$holiday);

PHP获取法定节假日接口

<?php
// 过慢,暂不使用 http://api.goseek.cn/Tools/holiday?date=20201002
// 正常工作日对应结果为 0, 法定节假日对应结果为 1, 节假日调休补班对应的结果为 2,休息日对应结果为 3
// 使用:http://tool.bitefu.net/jiari/?d=
// 工作日对应结果为 0, 休息日对应结果为 1, 节假日对应的结果为 2
$arr=[];
$start=strtotime('20191028');
for ($i=0; $i < 100; $i++) { 
    $now = $start+86400*$i;
    $day = date('Ymd', $now);
    $res = https_request("http://tool.bitefu.net/jiari/?d=".$day);
    if($res==1||$res==2){
        file_put_contents('holiday.txt', $day.PHP_EOL, FILE_APPEND);
    }
    usleep(300);
}

function https_request($url, $data = null){
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($curl, CURLOPT_TIMEOUT,6);
    if (!empty($data)){
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    }
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $output = curl_exec($curl);
    curl_close($curl);
    return $output;
}

.gitignore忽略已提交的文件

对于首次提交时,会忽略.gitignore中对应的文件。如果已提交再次修改.gitignore则不会忽略,仍会追踪文件变化。

解决:
git rm --cached folder/file 并修改.gitignore文件

另:
git update-index --assume-unchanged 的真正用法是这样的:

  1. 你正在修改一个巨大的文件,你先对其 git update-index --assume-unchanged,这样 Git
    暂时不会理睬你对文件做的修改
  2. 当你的工作告一段落决定可以提交的时候,重置改标识:git update-index
    --no-assume-unchanged,于是 Git 只需要做一次更新,这是完全可以接受的了
  3. 提交+推送

原文:https://segmentfault.com/q/1010000000430426

apache同时配置80和443端口 the first has precedence, perhaps you need a NameVirtualHost directive

同时添加:
NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:443>
    DocumentRoot "/www/hitortoise"
    ServerName www.r1989.com

    SSLEngine on
    SSLCertificateFile /www/ssl/2_www.r1989.com.crt
    SSLCertificateKeyFile /www/ssl/3_www.r1989.com.key
    SSLCertificateChainFile /www/ssl/1_root_bundle.crt
</VirtualHost>

<VirtualHost *:80>
     DocumentRoot "/www/hitortoise"
     ServerName www.r1989.com

     RewriteEngine on
     RewriteCond %{HTTP_HOST} ^www.r1989.com$
     RewriteRule ^/(.*)$ https://www.r1989.com/$1 [R=301,L]
</VirtualHost>