Commit ff99bd48 authored by caihaifei's avatar caihaifei

update.

parent f1c212f4
Pipeline #15356 canceled with stage
## 易服智享前端团队技术分享
本项目作为前端团队技术博客分享内容,文档格式采用MD文档格式编写。
\ No newline at end of file
......@@ -3,12 +3,12 @@
## Source: https://github.com/hexojs/hexo/
# Site
title: Hexo
title: 易服智享前端团队技术分享
subtitle: ''
description: ''
keywords:
author: John Doe
language: en
author: 易服智享前端团队
language: zh-CN
timezone: ''
# URL
......@@ -27,7 +27,7 @@ tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
i18n_dir: :languages
skip_render:
# Writing
......@@ -97,7 +97,7 @@ ignore:
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: landscape
theme: stun
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
......
......@@ -6,10 +6,11 @@
"build": "hexo generate",
"clean": "hexo clean",
"deploy": "hexo deploy",
"server": "hexo server"
"server": "hexo server",
"dev":"hexo clean && hexo s"
},
"hexo": {
"version": "5.4.0"
"version": "5.4.1"
},
"dependencies": {
"hexo": "^5.0.0",
......@@ -19,8 +20,9 @@
"hexo-generator-tag": "^1.0.0",
"hexo-renderer-ejs": "^1.0.0",
"hexo-renderer-marked": "^4.0.0",
"hexo-renderer-pug": "^3.0.0",
"hexo-renderer-stylus": "^2.0.0",
"hexo-server": "^2.0.0",
"hexo-theme-landscape": "^0.0.3"
}
}
\ No newline at end of file
}
---
title: Babel编译基础
author: 蔡海飞
date: 2022-03-15 15:58
---
## 操作指南
前端项目工程化不断迭代更新,新的语法功能、特性让代码的书写变得更加舒服、简洁、易读、可维护。然而,对于浏览器的语法兼容性,却并不能很好的完美兼容新提出的语法、特性,不同版本的浏览器对于兼容语法方面也有着较大的差异。这时候,babel的出现可以说是应运而生,通过对于es2015+的语法进行编译适配,可以让我们更好的关注于业务本省、用最简洁的的代码完成需求,而不需要关注不同版本之间的兼容问题。Babel可以在不同测场景有着不同的使用,如下介绍的则是在cli(命令行)环境下,如何使用babel为我们的项目实现编译兼容。
1. 安装babel
```
$ npm init
$ npm install --save-dev @babel/core @babel/cli
```
@babel/cli: babel自带的cli工具,可通过命令编译文件
@babel/core: babel功能核心库,babel转换核心库,可做一些中间操作
2. 创建配置文件 babel.config.json/babel.config.js/.babelrc
配置文件用于配置babel的部分预设功能
```json
// babel.config.json
{
"presets": ["@babel/preset-env"] // 启动 es6语法转换功能
}
```
如上配置需要安装 **@babel/preset-env**库,
```shell
$ npm install --save-dev @babel/preset-env
```
3、 创建一个js文件
```js
// Expression bodies
var odds = evens.map(v => v + 1);
var nums = evens.map((v, i) => v + i);
// Statement bodies
nums.forEach(v => {
if (v % 5 === 0)
fives.push(v);
});
// Lexical this
var bob = {
_name: "Bob",
_friends: [],
printFriends() {
this._friends.forEach(f =>
console.log(this._name + " knows " + f));
}
};
// Lexical arguments
function square() {
let example = () => {
let numbers = [];
for (let number of arguments) {
numbers.push(number * number);
}
return numbers;
};
return example();
}
square(2, 4, 7.5, 8, 11.5, 21); // returns: [4, 16, 56.25, 64, 132.25, 441]
```
4、 编译js
- 添加编译脚本
在package.json中添加:
```json
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build:babel": "babel src -d lib"
},
```
- 运行编译脚本
```
$ npm run build:babel
```
- 编译结果
```js
"use strict";
// lib/syntax.js
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
// Expression bodies
var odds = evens.map(function (v) { return v + 1;});
var nums = evens.map(function (v, i) {return v + i;}); // Statement bodies
nums.forEach(function (v) {
if (v % 5 === 0) fives.push(v);
}); // Lexical this
var bob = {
_name: "Bob",
_friends: [],
printFriends: function printFriends() {
var _this = this;
this._friends.forEach(function (f) {
return console.log(_this._name + " knows " + f);
});
}
}; // Lexical arguments
function square() {
var _arguments = arguments;
var example = function example() {
var numbers = [];
var _iterator = _createForOfIteratorHelper(_arguments),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var number = _step.value;
numbers.push(number * number);
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return numbers;
};
return example();
}
square(2, 4, 7.5, 8, 11.5, 21); // returns: [4, 16, 56.25, 64, 132.25, 441]
```
上面可以发现,使用@babel/preset预设编译可以完成es6的语法代码的转译(let、var、for…in、for…of等),但对于es6中新增的api功能并不能完成编译(Array.map、Array.forEach、Promise等)。为此,我们需要对于es6中新增的api进行单独的转译(本篇暂不介绍)。
源码示例:[GITHUB](https://github.com/amikoj/babelDemo/tree/main/sourceJs)
\ No newline at end of file
---
title: Hello World
---
Welcome to [Hexo](https://hexo.io/)! This is your very first post. Check [documentation](https://hexo.io/docs/) for more info. If you get any problems when using Hexo, you can find the answer in [troubleshooting](https://hexo.io/docs/troubleshooting.html) or you can ask me on [GitHub](https://github.com/hexojs/hexo/issues).
## Quick Start
### Create a new post
``` bash
$ hexo new "My New Post"
```
More info: [Writing](https://hexo.io/docs/writing.html)
### Run server
``` bash
$ hexo server
```
More info: [Server](https://hexo.io/docs/server.html)
### Generate static files
``` bash
$ hexo generate
```
More info: [Generating](https://hexo.io/docs/generating.html)
### Deploy to remote sites
``` bash
$ hexo deploy
```
More info: [Deployment](https://hexo.io/docs/one-command-deployment.html)
---
title: test_my_site
date: 2021-10-18 11:27:33
tags:
---
---
title: 前端缓存
author: 王许晓
date: 2021-11-11 10:00
---
**缓存是一种保存资源副本并在下次请求时直接使用该副本的技术**
## 缓存的种类
我相信只要你经常使用某个浏览器(Chrome,Firefox,IE等),肯定知道这些浏览器在设置里面都是有个清除缓存功能,这个功能存在的作用就是删除存储在你本地磁盘上资源副本,也就是清除缓存。
缓存存在的意义就是当用户点击back按钮或是再次去访问某个页面的时候能够更快的响应。尤其是在多页应用的网站中,如果你在多个页面使用了一张相同的图片,那么缓存这张图片就变得特别的有用。
<!-- more -->
### 代理服务器缓存
代理服务器缓存原理和浏览器端类似,但规模要大得多,因为是为成千上万的用户提供缓存机制,大公司和大型的ISP提供商通常会将它们设立在防火墙上或是作为一个独立的设备来运营。
由于缓存服务器不是客户端或是源服务器的一部分,它们存在于网络中,请求路由必须经过它们才会生效,所以实际上你可以去手动设置浏览器的代理,或是通过一个中间服务器来进行转发,这样用户自然就察觉不到代理服务器的存在了。
......@@ -15,6 +26,7 @@ CDNS(网络内容分发商)分布网关缓存到整个(或部分)互联网
数据库缓存是指当我们的应用极其复杂,表自然也很繁杂,我们必须进行频繁的进行数据库查询,这样可能导致数据库不堪重负,一个好的办法就是将查询后的数据放到内存中,下一次查询直接从内存中取就好了。关于数据库缓存本篇不会展开。
## 浏览器的缓存策略
> 浏览器对于缓存的处理是根据第一次请求资源时返回的响应头来确定的。
......
# 加密方式概览
---
title: 加密方式概述
author: 刘磊
date: 2021-11-12 9:00
---
# 加密方式概览
公元683年,唐中宗即位。随后,武则天废唐中宗,立第四子李旦为皇帝,但朝政大事均由她自己专断。  
  裴炎、徐敬业和骆宾王等人对此非常不满。徐敬业聚兵十万,在江苏扬州起兵。裴炎做内应,欲以拆字手段为其传递秘密信息。后因有人告密,裴炎被捕,未发出的密信落到武则天手中。这封密信上只有“青鹅”二字,群臣对此大惑不解。  
  武则天破解了“青鹅”的秘密:“青”字拆开来就是“十二月”,而“鹅”字拆开来就是“我自与”。密信的意思是让徐敬业、骆宾王等率兵于十二月进发,裴炎在内部接应。“青鹅”破译后,裴炎被杀。接着,武则天派兵击败了徐敬业和骆宾王。
<!-- more -->
  ![在这里插入图片描述](https://img-blog.csdnimg.cn/b8feae1f45f34291a8b49fee648f54e7.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBATEVJIExJVSAtLS3liY3nq68=,size_11,color_FFFFFF,t_70,g_se,x_16)
## 一.古典密码加密
**① 替换法**
......
## 简单了解面向对象编程(oop)和常见的几种设计模式
---
title: 简单了解面向对象编程(oop)和常见的几种设计模式
author: 杨靖
date: 2021-12-03 10:00
---
## 简单了解面向对象编程(oop)和常见的几种设计模式
***背景:***
......@@ -11,7 +17,7 @@
软件设计开发中存在很多其他的问题,上面只是从程序开发和设计的角度看到的部分问题。需求解决上面软件开发中的问题,就要求我们编写(设计)的软件具有很好的可读性、可维护性和可扩展性。我们需要保证代码具有高内聚低耦合,这里我们使用了OOP编程思想。
<!-- more -->
***oop四大基本特性:***
- 抽象:提取现实世界中某事物的关键特性,为该事物构建模型的过程。对同一事物在不同的需求下,需要提取的特性可能不一样。得到的抽象模型中一般包含:属性(数据)和操作(行为)。这个抽象模型我们称之为类。对类进行实例化得到对象。
......
stun @ 7d8f6db2
Subproject commit 7d8f6db2692a8d1284c346d7af26f22f5867cf6e
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment