Rainbow sea is mine https://blog.flxxyz.com/ zh-CN It's not worth it Mon, 14 Sep 2020 05:24:00 +0000 Mon, 14 Sep 2020 05:24:00 +0000 Code review: how to improve the force grid https://blog.flxxyz.com/technology/2020/code-review-acronyms.html https://blog.flxxyz.com/technology/2020/code-review-acronyms.html Mon, 14 Sep 2020 05:24:00 +0000 Feng Xiaoxian Recently submitted PR Comments by leaders LGTM A capital one It's in the brain. The abbreviations were checked and sorted out as follows:

  • PR: Pull Request. Pull requests, which have submitted code to open source projects, should all know
  • CR: Code Review. Code review
  • LGTM: Looks good to me. Yes, we can merge
  • TL;DR: Too long;Didn't read. The old woman's foot wrap.
  • TBR: To be reviewed. Give the labor review code!
  • WIP: Work in progress. Writing at the beginning of the title as an identification function is not completed
  • RFC: Request for comments. We usually hear that some policies want to be carried out. If the government wants to carry out these policies, the government will issue a draft for comments. The general meaning of open source projects is to ask for comments, which are used as task memoranda
  • ACK: Acknowledge. Confirm some contents, functions and tasks
zero https://blog.flxxyz.com/technology/2020/code-review-acronyms.html#comments https://blog.flxxyz.com/feed/technology/2020/code-review-acronyms.html
Do you have any programming needs https://blog.flxxyz.com/chat/2020/should-everybody-learn-how-to-code.html https://blog.flxxyz.com/chat/2020/should-everybody-learn-how-to-code.html Sun, 31 May 2020 15:16:00 +0000 Feng Xiaoxian Today, I went to visit my grandparents and played with my mobile phone. After playing with my mobile phone, my friend sent me a message: "is there any statement that can modify the folder path in batch?" so he asked about his needs. After half a minute's conversation, he found that it was dir/A => dir/2020/A According to the year corresponding to the excel table, classify the relevant catalog, and confirm that a few minutes is more than enough (too naive)

Since I didn't have a computer in hand and my mobile phone didn't have a proper editor, my friend suggested that he write it. I thought: OK.

Command is really difficult for people who have a programming foundation but can no longer reach their daily work. use readdirSync Listing all the directories under the directory has been operating for nearly half an hour, let alone debugging.

Calm down, I think, is it really necessary for ordinary people to learn? There is a certain need. If my friend simply grasps nodejs related skills, I believe that his work will be of great help. He does not need to manually copy and paste time-consuming, recognize the law of repetitive work, write scripts to execute the work, and efficiency will be his biggest experience.

After reading the above paragraph, it may mean "programming depends on work". I don't agree with this view. I agree with it Programming is a skill to improve productivity It can be understood in disguise as "Lazy" The friend mentioned above is just in the heavy processing of massive data, which is a little tricky. But if it's not related work, you can also use programming in other places to avoid being hit by the platform price difference when you buy your favorite items. You can master English indirectly and surf the Internet scientifically. Do not need to love, just because of interest and to understand, learn, meet the needs Happy, happy That's fine.

I saw it a few years ago "Python enters Shandong primary school textbooks" In retrospect, children's competitiveness has started since childhood. Cultivating thinking logic, observing children's interests and hobbies, and solving problems can be more logical.

After all, the lowest cost of open-source programming can be learned everywhere due to the low cost of the Internet, You don't lose if you don't learn.

zero https://blog.flxxyz.com/chat/2020/should-everybody-learn-how-to-code.html#comments https://blog.flxxyz.com/feed/chat/2020/should-everybody-learn-how-to-code.html
Nginx pan domain name resolution corresponding directory https://blog.flxxyz.com/technology/2020/nginx-wildcard-domain.html https://blog.flxxyz.com/technology/2020/nginx-wildcard-domain.html Fri, 22 May 2020 10:17:00 +0000 Feng Xiaoxian server { listen 80; server_ name ~^(?<subdomain>.+).example.com$; set $root /wwwroot/$subdomain; if ( -d /wwwroot/$subdomain/public) { set $root /wwwroot/$subdomain/public; } root $root; }

What works is server_ name This line, the path passes the path variable according to this line

zero https://blog.flxxyz.com/technology/2020/nginx-wildcard-domain.html#comments https://blog.flxxyz.com/feed/technology/2020/nginx-wildcard-domain.html
wsl spawn cmd.exe ENOENT https://blog.flxxyz.com/technology/2020/wsl-spawn-cmd-enoent.html https://blog.flxxyz.com/technology/2020/wsl-spawn-cmd-enoent.html Wed, 13 May 2020 13:48:00 +0000 Feng Xiaoxian A strange bug was found in WSL today. Shouldn't sh be called directly under WSL

use Create React App Create a react application, yarn start Now, output Starting the development server... And then throw one Error: spawn cmd.exe ENOENT I wonder how this WSL is called to windows again cmd.exe It's weird. Hey

go create-react-app Turn it over Source code , executed an operation to open the browser and found that open Class library judgment windows Not just checking process.platform Yes, by the way wsl and docker The environment is also used as the judgment condition. The following splicing command is the final source of all evil

 root of all evils

Two ways to fix this bug

  1. take /mnt/c/Windows/System32 Add back the WSL environment variables so that you can pull up the default browser
  2. react-scripts/scripts/start.js Note it out openBrowser(url.localUrlForBrowser);
zero https://blog.flxxyz.com/technology/2020/wsl-spawn-cmd-enoent.html#comments https://blog.flxxyz.com/feed/technology/2020/wsl-spawn-cmd-enoent.html
Go to get system version number https://blog.flxxyz.com/go/2020/get-system-version-number.html https://blog.flxxyz.com/go/2020/get-system-version-number.html Wed, 06 May 2020 07:08:00 +0000 Feng Xiaoxian

Gosh, gist is a half dead state. If you are interested in it, you can use it https://mirror.flxxyz.com/gist/

zero https://blog.flxxyz.com/go/2020/get-system-version-number.html#comments https://blog.flxxyz.com/feed/go/2020/get-system-version-number.html
Untitled https://blog.flxxyz.com/chat/2020/unknown.html https://blog.flxxyz.com/chat/2020/unknown.html Mon, 04 May 2020 12:00:00 +0000 Feng Xiaoxian  20200504_ 184824.jpg

 20200504_ 184921.jpg

 20200504_ 185001.jpg

zero https://blog.flxxyz.com/chat/2020/unknown.html#comments https://blog.flxxyz.com/feed/chat/2020/unknown.html
docker rm: can't remove XXX: No such file or directory https://blog.flxxyz.com/docker/2020/backing-filesystem-unknown.html https://blog.flxxyz.com/docker/2020/backing-filesystem-unknown.html Mon, 20 Apr 2020 06:38:00 +0000 Feng Xiaoxian This is really an Indian bug, 🤮 The directory cannot be deleted

 rm: can't remove XXX: No such file or directory

After searching through the docker's documents and issues, this seems to be related to the ftype of the XFS partition. According to other people's solutions, it can't be solved 🤮 Yes

In the end, it's better to reduce two versions. Of course, it's OK to reload the system Dafa

zero https://blog.flxxyz.com/docker/2020/backing-filesystem-unknown.html#comments https://blog.flxxyz.com/feed/docker/2020/backing-filesystem-unknown.html
Hello 2020 https://blog.flxxyz.com/chat/2020/Happy-New-Year.html https://blog.flxxyz.com/chat/2020/Happy-New-Year.html Tue, 31 Dec 2019 16:34:00 +0000 Feng Xiaoxian  QQ picture 20200420112354.jpg

three https://blog.flxxyz.com/chat/2020/Happy-New-Year.html#comments https://blog.flxxyz.com/feed/chat/2020/Happy-New-Year.html
Gugugu, a minimalist implementation of jquery https://blog.flxxyz.com/js/2019/simple-jquery.html https://blog.flxxyz.com/js/2019/simple-jquery.html Tue, 06 Aug 2019 09:42:00 +0000 Feng Xiaoxian JQuery just to understand the core of the exchange of his friends today. (it seems that I have been pigeoning for a long time.)

By the way, which CDN service provider can find a jQuery file to open. I use version 1.2.3 as an example. The latest version is similar, with only two or three changes https://cdnjs.cloudflare.com/ajax/libs/jquery/1.2.3/jquery.js

Source code analysis

17-20 lines Pass in the selector and return the init method of its own new. I guess you haven't used it $() The second parameter is omitted here

 var jQuery = window.jQuery = function(selector) {
    return new jQuery.prototype.init(selector);

Lines 26-27 This is why it always starts with $and is mounted under the window object, which is a global variable

 // Map the jQuery namespace to the '$' one
window.$ = jQuery;

Lines 36-547 Get rid of what we don't need, keep the core, stay init Method, the internal judge of jQuery instance and selector is made. Here we ignore and simplify

 JQuery. FN = jQuery. Prototype = {init: function (selector) {var nodes = document. Queryselectorall (selector); 
 for (VaR I in nodes) {this [i] = nodes [i]; 
} return this; 
 / / omit 100000 words 

549 lines In the previous paragraph, the jQuery prototype chain is passed to the init method prototype under the jQuery prototype. Looking back at the new code, it is very clear

 jQuery.prototype.init.prototype = jQuery.prototype;

Complete implementation

If you continue to add functions to the jQuery prototype, it will be very close to the original version of jQuery. Here I will simply implement it text() method

 var jQuery= function (selector) {
        return new jQuery.fn.init(selector);

    jQuery.fn = jQuery.prototype = {
        init: function (selector) {
            var nodes = document.querySelectorAll(selector);
            for (var i in nodes) {
                this[i] = nodes[i];
            return this;
         element: function (callback) {
            for (var i = 0; i < this.length; i++) {
        text: function (content) {
            if (content == '' || content) {
                this.element(function (node) {
                    node.innerHTML = content;
                 return content;
            } else {
                return this[0].innerHTML;

    jQuery.prototype.init.prototype = jQuery.prototype;

    window.$ = jQuery;


In fact, the core is not complicated at all. I like the implementation of plug-ins. I think most of their functions are implemented by plug-ins. The ingenious design of the tool itself and the convenience.

In the traditional page production, jQuery is very comfortable to use, but the emergence of MVVM has changed our way of thinking. We only need to pay attention to business logic, do not need to manually operate DOM, and do not need to pay attention to the synchronization of data status. It is much easier for project management.

If there are simple requirements on a single page, jQuery still has a place to use, MVVM can only be added to the trouble.

five https://blog.flxxyz.com/js/2019/simple-jquery.html#comments https://blog.flxxyz.com/feed/js/2019/simple-jquery.html
When I wake up, it's 2076 https://blog.flxxyz.com/chat/2019/cyberpunk-2077.html https://blog.flxxyz.com/chat/2019/cyberpunk-2077.html Thu, 13 Jun 2019 06:45:00 +0000 Feng Xiaoxian  cyberpunk-2077.jpg

Gog start, pre order!

seven https://blog.flxxyz.com/chat/2019/cyberpunk-2077.html#comments https://blog.flxxyz.com/feed/chat/2019/cyberpunk-2077.html