Skip to content

Commit

Permalink
update protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
wzhai-hub committed Mar 15, 2024
1 parent c3ce595 commit 51309b5
Show file tree
Hide file tree
Showing 38 changed files with 267 additions and 159 deletions.
2 changes: 1 addition & 1 deletion content/Frontend/HTML/xx/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

title: "HTML Tags"
subtitle: ""
summary: "HTML常用标签"
summary: "HTML(HyperText Markup Language)是用于创建网页的标记语言,常用标签有很多"
authors: []
# tags:
# - system desigin
Expand Down
2 changes: 1 addition & 1 deletion content/Frontend/React/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cms_exclude: true
# 1 = List
# 2 = Compact
# 3 = Card
view: 3
view: 2

# Optional header image (relative to `static/media/` folder).
header:
Expand Down
Binary file removed content/Frontend/React/featured.jpg
Binary file not shown.
Binary file added content/Frontend/React/hook/featured.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
---
title: React
# tags:
# - nodejs
date: '2023-11-04'
summary: React Hoods
---

以下是 React 提供的一些常见的 Hooks。请注意,React 生态系统可能会有新的更新,因此建议查阅[React 官方文档](https://reactjs.org/docs/hooks-reference.html)以获取最新信息。

1. **useState:**
Expand Down
Binary file added content/Language/C++/Algorithm/featured.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
---
title: C++ 标准库算法
# tags:
# - nodejs
date: '2023-11-04'
summary: C++ 标准库提供了许多算法,这些算法位于 `<algorithm>` 头文件中。这些算法可用于各种容器,如数组、向量、列表、集合等
---

C++ 标准库提供了许多算法,这些算法位于 `<algorithm>` 头文件中。这些算法可用于各种容器,如数组、向量、列表、集合等。以下是一些常见的 C++ 算法:

1. **排序算法:**
Expand Down
Binary file added content/Language/C++/Lambda/featured.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
---
title: Lambda 函数
# tags:
# - nodejs
date: '2023-11-04'
summary: Lambda 函数是 C++11 引入的一项特性,它允许你在代码中创建匿名函数,即没有函数名的函数。Lambda 函数通常用于需要短暂使用的小规模操作,例如在算法中作为参数传递,或在容器中进行转换等
---

Lambda 函数是 C++11 引入的一项特性,它允许你在代码中创建匿名函数,即没有函数名的函数。Lambda 函数通常用于需要短暂使用的小规模操作,例如在算法中作为参数传递,或在容器中进行转换等。

Lambda 函数的基本语法如下:
Expand Down
Binary file added content/Language/C++/STL/featured.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
---
title: C++ 标准库(Standard Library)提供了许多库函数
# tags:
# - nodejs
date: '2023-11-04'
summary: C++ 标准库(Standard Library)提供了许多库函数,涵盖了广泛的功能领域。这些库函数分为几个主要的头文件,并包括各种类、函数和算法
---

C++ 标准库(Standard Library)提供了许多库函数,涵盖了广泛的功能领域。这些库函数分为几个主要的头文件,并包括各种类、函数和算法。以下是一些常见的 C++ 库函数的主要类别和示例:

1. **输入输出库 (`<iostream>``<iomanip>``<fstream>`等):**
Expand Down
Binary file added content/Language/C++/new-features/featured.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
---
title: C++11 新特性
tags:
- nodejs
date: '2023-11-04'
summary: C++11 新特性:自动类型推导,Range-Based for Loop,Lambda 表达式,Smart Pointers...
---

C++11 新特性

1. **自动类型推导 (auto)**: `auto` 关键字允许编译器根据变量的初始化值来自动推断其数据类型,使代码更具灵活性和可读性。
Expand Down Expand Up @@ -37,6 +45,6 @@ C++11 新特性

这些是 C++11 中的一些重要特性,您可以选择其中一些特性进行详细介绍,以便在 PPT 汇报中展示 C++11 的新功能和改进。

https://en.cppreference.com/w/cpp/11
<!-- https://en.cppreference.com/w/cpp/11 -->

https://en.wikipedia.org/wiki/C%2B%2B11
<!-- https://en.wikipedia.org/wiki/C%2B%2B11 -->
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

---
title: C++ 标准库提供了丰富的算法集合
# tags:
# - nodejs
date: '2023-11-04'
summary: C++ 标准库提供了丰富的算法集合,这些算法位于 `<algorithm>` 头文件中。这些算法用于在各种容器(如数组、向量、列表、映射等)上执行各种操作,包括搜索、排序、变换等
---
## 算法
C++ 标准库提供了丰富的算法集合,这些算法位于 `<algorithm>` 头文件中。这些算法用于在各种容器(如数组、向量、列表、映射等)上执行各种操作,包括搜索、排序、变换等。以下是一些常见的 C++ 算法:

Expand Down
Binary file added content/Language/C++/transform/featured.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
---
title: C++ 标准库中的一个算法transform
# tags:
# - nodejs
date: '2023-11-04'
summary: std::transform 是 C++ 标准库中的一个算法,位于头文件 <algorithm> 中。该算法用于对指定范围的元素执行某种操作,并将结果存储到另一个范围中。
---

`std::transform` 是 C++ 标准库中的一个算法,位于头文件 `<algorithm>` 中。该算法用于对指定范围的元素执行某种操作,并将结果存储到另一个范围中。

`std::transform` 的基本语法如下:
Expand Down
3 changes: 0 additions & 3 deletions content/Language/nodejs/Typescript.md

This file was deleted.

73 changes: 0 additions & 73 deletions content/Language/nodejs/eslint.md

This file was deleted.

Binary file added content/Language/nodejs/eslint/featured.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 73 additions & 0 deletions content/Language/nodejs/eslint/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
title: Eslint plugin for TypeScript
tags:
- nodejs
date: '2023-11-04'
summary: ESLint is a valuable tool for improving code quality, maintaining consistency, preventing errors
---

<!-- TypeScript is a strongly typed programming language that builds on JavaScript.
TypeScript adds additional syntax to JavaScript that allows you to declare the shapes of objects and functions in code. It provides a set of language services that allow for running powerful inferences and automations with that type information.
ESLint is an awesome linter for JavaScript code.
ESLint statically analyzes your code to quickly find problems. It allows creating a series of assertions called lint rules around what your code should look or behave like, as well as auto-fixer suggestions to improve your code for you, and loading in lint rules from shared plugins. -->

## why Typescript need ESLint
ESLint is widely used in the JavaScript development ecosystem. The rule can help enforce a consistent coding style across a project or team. ESLint assists in maintaining high code quality standards,catches common programming errors and potential bugs during development.
ESLint is highly configurable. Developers can customize its rules based on the requirements of their projects or teams. This flexibility allows ESLint to adapt to different coding styles and preferences.

ESLint is a valuable tool for improving code quality, maintaining consistency, preventing errors. JavaScript development projects. It helps developers write cleaner, more reliable code.

## mainly eslint plugin package

1. **@typescript-eslint/eslint-plugin**
- An ESLint plugin which provides lint rules for TypeScript codebases.

2. **@typescript-eslint/parser**
- An ESLint parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.
3. **eslint**:
- ESLint uses Espree for JavaScript parsing.
- ESLint uses an AST to evaluate patterns in code.
- ESLint is completely pluggable, every single rule is a plugin and you can add more at runtime.

4. **@typescript-eslint/eslint-plugin-tslint**
- ESLint plugin that wraps a TSLint configuration and lints the whole source using TSLint.
5. **eslint-config-prettier**:
- Turns off all rules that are unnecessary or might conflict with Prettier.
- This lets you use your favorite shareable config without letting its stylistic choices get in the way when using Prettier.
- Note that this config only turns rules off, so it only makes sense using it together with some other config.

## others common eslint plugin

- **eslint-plugin-import**
- **eslint-plugin-jsdoc**
- **eslint-plugin-no-null**
- **eslint-plugin-prefer-arrow**
- **eslint-plugin-sonarjs**
- **eslint-plugin-unicorn**
- **prettier**
- **sonarjs**
- **eslint-config-prettier**
- **eslint-plugin-etc**
- **eslint-plugin-jsdoc**
- **eslint-plugin-node**
- **eslint-plugin-prefer-arro**
- **eslint-plugin-sonarjs**
- **eslint-plugin-unicorn**
- **eslint-config-airbnb**
- **eslint-import-resolver-typescript**
- **eslint-plugin-etc**
- **eslint-plugin-jsx-a11y**
- **eslint-plugin-node**
- **eslint-plugin-prefer-arrow**
- **eslint-plugin-react**
- **eslint-plugin-react-hooks**

## Typescript/ESLint Link

if you want to know about typescript and eslint rules,please refer below.
- https://typescript-eslint.io/rules/

- https://eslint.org/docs/latest/rules/


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# Javascript all(),bind(),apply() 方法介绍
---
title: Javascript all(),bind(),apply()
tags:
- nodejs
date: '2023-11-04'
summary: You need to know Javascript all(),bind(),apply()
---

### 1 下面简化程序不work:
### Javascript all(),bind(),apply() 方法介绍

```
1. 下面简化程序不work:

``` JavaScript
var abc = {
sendmail: function () {
console.log("sendmail")
Expand All @@ -15,20 +23,19 @@ var abc = {
setInterval(abc.get, 1000);

```
### 输出结果:
输出结果:

```
``` javascript
this.sendmail();
^

TypeError: this.sendmail is not a function

```
### 正确修改方法是:setInterval(abc.get.bind(abc), 1000); 为什么需要bind呢?

# 今天重温Javascript中call(), apply() 和 bind()函数是什么意思?
## 首先查看Javascript 函数属性有哪些?
```
2. 正确修改方法是:setInterval(abc.get.bind(abc), 1000); 为什么需要bind呢?
今天重温Javascript中call(), apply() 和 bind()函数是什么意思?
首先查看Javascript 函数属性有哪些?
``` javascript
interface Function {
/**
* Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function.
Expand Down Expand Up @@ -63,9 +70,9 @@ interface Function {
caller: Function;
}
```
## 具体细节我就不再讲述了,代码有注释。举个例子说明吧:
## 先看下bind函数,官方文档说:该bind()方法创建了一个新函数,在调用时,其this关键字设置为提供的值。这是非常强大的。它让我们明确定义this调用函数时的值。让我们分解一下。当我们使用该bind()方法时:JS 引擎正在创建一个新pokemonName实例并将pokemon其绑定为它的this变量。理解它复制 pokemonName 函数很重要。创建pokemonName函数的副本后,它可以调用logPokemon(),尽管它最初不在 pokemon 对象上。它现在将识别其属性(Pika and Chu)及其方法。很酷的事情是,在我们 bind() 一个值之后,我们可以像使用任何其他普通函数一样使用该函数。我们甚至可以更新函数以接受参数,传递它们.
```
3. 具体细节我就不再讲述了,代码有注释。举个例子说明吧:
先看下bind函数,官方文档说:该bind()方法创建了一个新函数,在调用时,其this关键字设置为提供的值。这是非常强大的。它让我们明确定义this调用函数时的值。让我们分解一下。当我们使用该bind()方法时:JS 引擎正在创建一个新pokemonName实例并将pokemon其绑定为它的this变量。理解它复制 pokemonName 函数很重要。创建pokemonName函数的副本后,它可以调用logPokemon(),尽管它最初不在 pokemon 对象上。它现在将识别其属性(Pika and Chu)及其方法。很酷的事情是,在我们 bind() 一个值之后,我们可以像使用任何其他普通函数一样使用该函数。我们甚至可以更新函数以接受参数,传递它们.
```javascript
var pokemon = {
firstname: 'Pika',
lastname: 'Chu ',
Expand All @@ -84,9 +91,9 @@ var logPokemon = pokemonName.bind(pokemon); // creates new object and binds poke
logPokemon(); // 'Pika Chu I choose you!'
```

## call(), apply()方法,call() 的官方文档说:该call()方法调用具有给定this值和单独提供的参数的函数。这意味着我们可以调用任何函数,并明确指定在调用函数中this应该引用什么。与bind()方法真的很像!bind()和call()主要区别在于call()方法接受额外的参数,立即执行它被调用的函数,call() 方法不会复制正在调用它的函数。call()并apply()服务于完全相同目的。它们工作方式的唯一区别是call() 期望所有参数单独传入,而 apply() 期望我们所有参数的数组。请注意,apply 接受数组,并且 call期望转递每个参数。
call(), apply()方法,call() 的官方文档说:该call()方法调用具有给定this值和单独提供的参数的函数。这意味着我们可以调用任何函数,并明确指定在调用函数中this应该引用什么。与bind()方法真的很像!bind()和call()主要区别在于call()方法接受额外的参数,立即执行它被调用的函数,call() 方法不会复制正在调用它的函数。call()并apply()服务于完全相同目的。它们工作方式的唯一区别是call() 期望所有参数单独传入,而 apply() 期望我们所有参数的数组。请注意,apply 接受数组,并且 call期望转递每个参数。

```
``` javascript
var pokemon = {
firstname: 'Pika',
lastname: 'Chu ',
Expand All @@ -105,8 +112,8 @@ pokemonName.apply(pokemon,['sushi', 'algorithms']); // Pika Chu loves sushi and

```

### 这些存在于每个 JS 函数中的内置方法非常有用。即使您最终没有在日常编程中使用它们,您在阅读其他人的代码时仍然会经常遇到它们。
这些存在于每个 JS 函数中的内置方法非常有用。即使您最终没有在日常编程中使用它们,您在阅读其他人的代码时仍然会经常遇到它们。

### 参考文档
[1] [mozilla.org](https://developer.mozilla.org/en-US/docs/Web/JavaScript/)
[1] [mozilla.org](https://developer.mozilla.org/en-US/docs/Web/JavaScript/)
[2] [medium.com](https://medium.com/@omergoldberg/javascript-call-apply-and-bind-e5c27301f7bb)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@

---
title: Javascript deeep copy
tags:
- nodejs
date: '2023-11-04'
summary: Understand Javascript deeep copy
---


# Javascript 深拷贝与浅拷贝

## JavaScript是一种高级的,动态类型化脚本语言。像大多数其他编程语言一样,JavaScript允许支持深层拷贝和浅层拷贝的概念
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 51309b5

Please sign in to comment.