Today, when I visited my grandparents and played with my mobile phone, my friend sent a message, "is there any statement to batch modify the folder path"? Dir/A = > dir/2020/A According to the corresponding catalogues corresponding to the year of the excel table, we can confirm that there are more than a few minutes to decide (Tai Tianzhen).

Because I didn't have a computer on my hand, and there was no suitable editor for my cell phone, my friend suggested that he write it. I thought, OK.

Command is really difficult for people who have a programming basis, but those who can't touch them anymore. Use ReaddirSync List all the directories in the directory for nearly half an hour, but not even debugging.

Calm down, I think, is it really necessary for ordinary people to learn? It is necessary that if this friend of mine can grasp a little bit of nodejs related skills, I believe that his work will be of great help. It will be a great experience for him to manually copy and paste the work without wasting time and effort, to recognize the regularity of repetitive work and to write script execution.

After reading the above passage, it may be a little bit "programming dependent on work". I do not agree with this view. Programming is a skill to improve productivity. It can be understood in disguise. "Lazy" The friends mentioned before are just in the heavy handling of massive data, a bit tricky, but if they are not related work, you can also use programming in other places, so that you can avoid buying your favorite items by being hit by platform price difference, and can indirectly grasp English, for scientific Internet access. No need to love, just because of interest, to understand, to learn, to meet the needs. Happy and happy All right.

I saw it a few years ago. "Python enters primary school textbooks in Shandong" Related news, in retrospect, the competitiveness of children began from childhood, to cultivate the logic of thinking, observe children's interests and solve problems can be more logical thinking.

Besides, programming should be regarded as the skill with the lowest threshold. After all, this era is full of procedures, thanks to the open source sharing spirit of the Internet, so that the relevant information can be readily available, the cost is really low, and learning is fruitful. If you do not learn, you will not lose.

Today, we found a strange bug with WSL. Should we not call sh directly under WSL?

Use Create React App Create react application, Yarn start Once, output Starting the development server... And then throw out one. Error: spawn Cmd.exe ENOENT I wonder how the WSL is invoked under windows. Cmd.exe What a strange mother!

go Create-react-app Flip down Source code It has implemented an open browser operation. Open Class library judgment Windows It's not just checking. Process.platform Value, incidentally. WSL and Docker The environment is also used as a condition for judgement. The following command is the last source of all evil.

 root of all evils

Fix the two way of bug.

  1. take /mnt/c/Windows/System32 Add the environment variables to WSL so that you can pull up the default browser.
  2. React-scripts/scripts/ Start.js Note out OpenBrowser ( Url.localUrlForBrowser );

This is really India bug. A kind of One hundred percent of the errors can not be deleted.

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

It has gone through the docker documents and issue, which seems to be related to the ftype of XFS partition, and can not be solved according to other people's plan. A kind of

In the end, two versions will be completed. Of course, reinstall the system.

Today, just an old friend chatted up the jQuery source code. He didn't understand the source code. I had a learning and communication attitude and explained the core realization to him. (as if he had been pigeon for a long time).

By the way, which CDN service provider is looking for a jQuery file to open? The 1.2.3 version I use here is for example. The latest version is almost the same, with only two or three changes. Https://cdnjs.cloudflare.com/ajax/libs/jquery/1.2.3/jquery.js

Source code analysis

17-20 elements Pass the selector and return the init method of your own new. It is estimated that you haven't used it either. $() The second parameter is omitted here.

 Var jQuery = Window.jQuery = function (selector) {
return NEW JQuery.prototype.init (selector);}

26-27 elements This is why it is always a global variable to mount to a window object because of the beginning of $.

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

36-547 elements Eliminate the core of retention that we do not need. Init Method, the jQuery instance and the selector are judged internally. 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;}} / / here omitted one hundred thousand words}

549 elements In the last paragraph, the jQuery prototype chain is passed to the prototype of the init method under the jQuery prototype. Looking back at the new code, it is clear and clear.

 JQuery.prototype.init .prototype = JQuery.prototype ;

Complete implementation

Adding functionality to the jQuery prototype is very close to the first version of jQuery. Here I am a simple implementation. 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++) {
callback (this[i]); 
text:}}, 
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;

End

Actually, the core is not complicated. I like it very much. I think most of my functions are implemented by plug-ins. The ingenious design and convenience of the tools themselves.

On the traditional page production, jQuery used a very comfortable shuttle, but the appearance of MVVM changed the way of thinking. We only need to pay attention to business logic, do not need to manually operate DOM, do not need to pay attention to the synchronization of data status, and ease the project management.

If there are simple needs on a single page, jQuery is still useful, MVVM can only be added trouble.

Quick deployment of multi site environments, based on docker, docker-compose layout is easy to add directly, and each site independently uses a FPM instance to perform better.

Link: Flxxyz/fast-deploy-website


I feel so good lately.

TX Hongkong is like a bomb? Since the record is still considered to move into the domestic 8

The old version of the pagoda, which is used before the panel, is still in use. It plans to backup the site and reset the server. A few days ago, it used docker to configure instances in the house virtualization device.