Weekly Issue 10: How do you find reliable information online?

This week’s news

Git 2.36 Highlights

On April 18, Git officially released version 2.36 , which contains 96 contributors’ changes, including 26 new features. Here are some new features that I am more interested in:

  1. git log –remerge-diff, better display diffs of merge commits, previously, if we looked at a commit diff with a merge conflict, the result of the input was often hard to understand, now with --remerge-diff you can Display differences with mergeconflictStyle .
  2. Stricter repository permission checks, as of version 2.35, there were two security vulnerabilities that affected users working on multi-user machines, which could allow one user to execute arbitrary commands on other users’ repositories , a security patch was released in Git version 2.35.2 , in general Git changed the default behavior to prevent this from happening, and we can also bypass this behavior meaningfully with the latest safe.directory configuration.
  3. We all know that the git bisect command can be used for binary search to quickly locate commits that introduce bugs. At the same time, it can also automate this process by specifying an executable script, git bisect run test.sh , but before this, Git did not Checking if the specified file was an executable script, which caused bisect to run with an error, is now fixed.
  4. There are many more, if you are interested in learning about it yourself.

Ask HN: How do you find reliable information online?

A post I saw on hacker news, in the age of information explosion, how do we find reliable information online? Summarized some points that I think are useful:

  1. Look for “information” in information sources, not “opinions”. We obtain our own “opinions” based on these “information”, and at the same time, verify our “opinions” with an open mind, and pay attention to those who have different views than you. .
  2. Never trust a single source of information, like don’t just look at domestic media 🙂
  3. Get out of the information cocoon and learn to use RSS to subscribe to the content you are interested in, but finding useful sources of information is also a big problem.
  4. Try searching for your question in English, and if Google doesn’t work, try Teclis .

some tips

JavaScript displays the corresponding text color according to the background color

Today in 2022, dark mode has become an indispensable function of any application that focuses on user experience. One of the common requirements is to determine the corresponding text color according to the background color. Here I will briefly describe my implementation thinking.

First of all, we need to know that any color has a corresponding gray value. After obtaining the corresponding gray value of the color, we can know whether the color is bright or dark.

The formula to obtain the gray value is: (0.299 * r + 0.587 * g + 0.114 * b ) / 255

Let’s simply test it:

 1
2
3
4
5
6
7
8
9
10
11
 /**
* get grayscale from rgb
*/
function getGrayLevelFromRgb ( [r, g, b] ) {
return ( 0.299 * r + 0.587 * g + 0.114 * b) / 255
}

console .log(getGrayLevelFromRgb([ 255 , 255 , 255 ])) // 1
console .log(getGrayLevelFromRgb([ 0 , 0 , 0 ])) // 0
console .log(getGrayLevelFromRgb([ 255 , 0 , 0 ])) // 0.299
console .log(getGrayLevelFromRgb([ 18 , 18 , 18 ])) // 0.07058823529411765

And we only need to set a threshold, if it is greater than this threshold, it belongs to light, otherwise it is dark.

The threshold I set here is 0.85, and the specific threshold depends on the actual situation.

Save read-only files in Vim

 1
 :w ! sudo tee % > /dev/null 

Mac hides specific apps in the dock

Sometimes we want to hide specific applications in the Mac’s dock, which can be done like this:

 1
 sudo lsappinfo setinfo -app XXX ApplicationType=UIElement 

share article

How to spend two years interviewing someone

This is an article from 11 years ago (2011) but still very useful today, it’s a bit longer, but I recommend reading it anyway.

Here is a brief summary of some of the content of this article. This article starts by asking a question: recruiting is difficult, and it is difficult to get to the sky .

This is because:

  1. The best people may decide where to go without submitting a resume. So find them before they make a decision.
  2. The poorer ones will submit their resumes many times. The more time they have to find a job, the more resumes they submit, which will bring a lot of noise to the entire pool. The top 10% of the resumes may not be the top 10% of all people at all.

It is very important for a company to recruit reliable people, so recruitment may be the most important part of a company’s decision-making .

The author of this article gives some suggestions on how to do recruitment based on some of his experience.

Finally, the author gives a method of how to spend two years interviewing a person, that is, to look at the interviewee’s usual accumulation. The recommended method is: book + GitHub, which is enough for an interview of about two years.

You should read academic computer science papers

As a working programmer, you need to keep learning, and you can do that by checking out tutorials, documentation, StackOverflow, and anything else you can find to help you code better and keep your skills up to date. But have you tried digging into computer science papers to improve your programming skills?

While the tutorials mentioned above can help you write code in no time, reading academic papers can help you understand the ins and outs of programming, from null pointers to objects, most of these everyday functions in programming can be traced back to the 1960s and the future. innovations are built on today’s research.

So, try to learn about these programming directly by reading the paper, and if you think reading the paper is too difficult, you can try watching these talks: PapersWeLove – YouTube .

WebAssembly uses the JavaScript garbage collector

We know that JavaScript has its own garbage collection mechanism, but WebAssembly does not have this mechanism, because it runs in a relatively low-level environment, and we can only allocate memory by ourselves.

There is currently a proposal for WebAssembly that involves implementing a garbage collection mechanism, but unfortunately it’s still in Stage 2, and no browsers have implemented it yet.

The author of this article found a tricky way to achieve this requirement, that is, to use WeakRefs, in general, to implement a permanent loop function through the WeakRefs feature to do garbage collection.

If you are interested, you can read the relevant implementation code .

interesting link

  • IT Tools : A developer tool that includes functions for daily use, such as Base64 conversion, QR Code generation, URL parsing, etc., with an excellent user experience.
  • Operator Lookup : Enter a JavaScript operator (eg +, =>), it will explain the function of the operator, very useful for beginners.
  • Git Explorer : Find the Git command you want through the question-and-answer method, and use Git commands to no longer ask for help.
  • macOS Setup Guide : This guide covers the basics of setting up a development environment on a new Mac. It is intended for anyone to use as a guide for setting up an environment or installing languages/libraries.

This article is reprinted from: https://4ark.me/post/weekly-10.html
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment

Your email address will not be published.