This is a weekly roundup of awesome DEV comments that you may have missed. You are welcome and encouraged to boost posts and comments yourself using the #bestofdev tag.
Everyone is looking for love and @aimerib tied the knot this weekend. Wish the newlyweds well in the What's your Win this Week? thread:
I'm getting married tomorrow! That is one of my biggest wins!
@nateous finds the best of both worlds to use Microsoft's license agreement in Issues with VSCODE License — You should worry:
Microsoft has code in their version that they don't want you to decompile. That is all. Hence the license agreement.
I still use the version from Microsoft on my Mac for personal projects. If I don't want Microsoft to watch what I do with their software I'll compile my own version. Until then, they will continue to update the software based on the usage data they track. Best of both worlds if you ask me.
Puzzle coding test has a time and a place, but @jeremycmorgan as a manager says these don't make or break a candidate in: Unpopular opinion? I don't do puzzle coding tests:
In my opinion these tests are not an accurate representation of a coder's abilities, however I think coders should learn this, and get good at it.
As a developer I started running into these tests and not doing well on them. So I started practicing them and getting good at them so I didn't fall on my face in an interview. I learned a few things about algorithms that helped me be a better developer.
From a manager standpoint, sometimes I would give these out as well, however I found good programmers who did poorly on tests and vice versa. So I didn't base my hiring on how they did, but rather just looked at how they think. How they solve problems.
I think every developer should at least practice and try to get good at these kinds of tests. There are things you'll learn in the process that will help you as a developer.
@sidvishnoi shares that JSON.stringify(obj)
may not follow property order, which matters when the serialization is input for hashing/checksum in the The Secret Power of JSON Stringify thread:
Regarding the second items white list (array) argument:
We can use it to create a simple object hashing function (similar to object-hash, but with limitation of maximum object depth 1). The important thing is, JSON.stringify(obj)
may not follow property order, which matters when the serialization is input for hashing/checksum. Instead we can pass Object.keys(obj).sort()
as the 2nd argument, and the JSON will be stringified in that property order only.
function objectHash(obj: object): string {
const str = JSON.stringify(obj, Object.keys(obj).sort());
return createHash('sha1').update(str).digest('hex');
}
View code snippet for client-side at GitHub
View code snippet for Node.js at GitHub and tests
Ever thing of NPM as Legos? @dansilcox walks us through NPM in the eyes of a 5 year old in this explanation: NPM Explain to Me like I'm five:
You want to build a cool spaceship out of Lego - someone else already made a rocket engine, a fuel tank, some grid fins and a launch tower - so you use NPM to find and get the premade components to build your space ship faster. Then, when you launch you realise that because nobody verified that the components were secure, someone hid a stow away on your spaceship 😂
See you next week for more great comments ✌
Top comments (1)
Congratulations to @aimerib @nateous @jeremycmorgan @sidvishnoi and @dansilcox for making the list this week!