本文譯自 Julio Merino 2018 年七月撰寫的 Rust vs. Go 一文。Julio Merino 是 G 社僱員,在 G 社工作超過 8 年,無論工作內外,都接觸開發不少 Go 語言,並撰寫 [Rust 點評][rust-review]系列文,來聽聽他對 Rust 與 Go 的想法吧。
Thanks Julio Merino for this awesome article!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildingData = {'metalMine':{'id':1, 'type':'supply'}, | |
'crystalMine':{'id':2, 'type':'supply'}, | |
'deuteriumSynthesizer':{'id':3, 'type':'supply'}, | |
'solarPlant':{'id':4, 'type':'supply'}, | |
'fusionReactor':{'id':12, 'type':'supply'}, | |
'solarSatellite':{'id':212, 'type':'supply'}, | |
'metalStorage':{'id':22, 'type':'supply'}, | |
'crystalStorage':{'id':23, 'type':'supply'}, | |
'deuteriumTank':{'id':24, 'type':'supply'}, | |
'roboticsFactory':{'id':14, 'type':'station'}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////////////////////////////////////////////// | |
// | |
// Node.js HTTP file server example. | |
// | |
// Serves documents via GET requests with CORS headers and (if enabled) | |
// additionally permits writes via POST requests. | |
// | |
// Before using, PLEASE be aware of the security risks associated with | |
// running a server like this on publicly accessible machines! | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<el-menu :router="true" :default-active="activeLink"> | |
<template v-for="rule in $router.options.routes"> | |
<el-submenu v-if="rule.children && rule.children.length > 0" | |
:index="rule.path" | |
> | |
<template slot="title"><i :class="rule.icon"></i>{{ rule.title }}</template> | |
<el-menu-item v-for="child in rule.children" :index="rule.path + '/' + child.path">{{ child.title }}</el-menu-item> | |
</el-submenu> | |
<el-menu-item v-else |
How do I dropdown?
This is how you dropdown.
<details> <summary>How do I dropdown?</summary> <br> This is how you dropdown.
Not all random values are created equal - for security-related code, you need a specific kind of random value.
A summary of this article, if you don't want to read the entire thing:
- Don't use
Math.random()
. There are extremely few cases whereMath.random()
is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case. - Don't use
crypto.getRandomBytes
directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable. - If you want to generate random tokens or API keys: Use
uuid
, specifically theuuid.v4()
method. Avoidnode-uuid
- it's not the same package, and doesn't produce reliably secure random values. - If you want to generate random numbers in a range: Use
random-number-csprng
.
You should seriously consider reading the entire article, though - it's
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This fixes Permission denied errors you might get when | |
# there are git symlinks being used on repositories that | |
# you share in both POSIX (usually the host) and Windows (VM). | |
# | |
# This is not an issue if you are checking out the same | |
# repository separately in each platform. This is only an issue | |
# when it's the same working set (aka make a change w/out | |
# committing on OSX, go to Windows VM and git status would show | |
# you that change). | |
# |
NewerOlder