> 2021年09月16日信息消化 ### 3 Mindsets I Stole From Jeff Bezos — Even Though I Hate Him origin: [3 Mindsets I Stole From Jeff Bezos — Even Though I Hate Him](https://entrepreneurshandbook.co/3-mindsets-i-stole-from-jeff-bezos-even-though-i-hate-him-d8c3cc834683) ##### The 70% Rule Amazon’s business philosophy boils down to three letters and one digit. “Day 1.” As you may have guessed, the idea is to consider every day in your company as the first. 亚马逊的经营理念可以归结为三个字母和一个数字。"第1天"。正如你可能已经猜到的,这个想法是把你公司的每一天都视为第一天。 Why? “Day 2 is stasis. Followed by irrelevance. Followed by excruciating, painful decline. Followed by death,” Bezos [wrote](https://s2.q4cdn.com/299287126/files/doc_financials/annual/2016-Letter-to-Shareholders.pdf). “And that is why it is always Day 1.” "第2天是停滞不前。紧接着是不相关。紧接着是令人痛苦的衰退。随后是死亡,"贝索斯[写道](https://s2.q4cdn.com/299287126/files/doc_financials/annual/2016-Letter-to-Shareholders.pdf)。"这就是为什么它总是第1天。" In most cases, Day 2 doesn’t happen overnight. Rather, it’s a slow burn that lasts years or even decades. According to Bezos, the main cause of such decay is slow decision-making. “Day 2 companies make high-quality decisions,” he said. “But they make high-quality decisions slowly.” 在大多数情况下,第2天并不是一夜之间发生的。相反,它是一个持续几年甚至几十年的缓慢燃烧。根据贝索斯的说法,这种衰败的主要原因是决策缓慢。"第二天的公司做出高质量的决定,"他说。"但他们做出高质量的决定很慢。" Bezos also highlighted that, on average, a high-quality decision requires 90% of the information you think you need to make that decision. 贝索斯还强调,平均而言,一个高质量的决策需要90%的你认为做出该决策所需的信息。 Day 2 companies strive to gather the said 90% and that’s exactly why they die. It’s like obsessing over what to buy with your sales coupons and just as you make up your mind, you realize they’ve expired. 第二天的公司努力收集上述90%的信息,这正是他们死亡的原因。这就像纠结于用你的销售优惠券买什么,正当你下定决心时,你发现它们已经过期。 The alternative? Bezos calls it the 70% rule. Here’s how it works. 另一种选择呢?贝索斯称其为70%规则。它的原理是这样的。 > You should make your decision as soon as you gather 70% of the information you wish you had to make that decision. How do you know how much information is 70%? You don’t. You make an estimation based on a system. Here are three simple tools I’ve been using to apply the 70% rule to my business decisions. 这里有三个简单的工具,我一直在使用,将70%的规则应用于我的商业决策。 - **Checklists.** Every decision comes with a series of questions. How much does this cost? When will it become profitable? How can I scale it? Who can help me? As soon as you fill in 70% of the answers, stop thinking and make your move. **检查清单。**每个决定都伴随着一系列的问题。这需要多少钱?它什么时候能盈利?我怎样才能扩大它的规模?谁能帮助我?一旦你填写了70%的答案,就停止思考,开始行动。 - **Schedules.** Instead of tracking the quantity of information, track the time you spend on a given decision. Say you gave yourself ten days to study an investment opportunity. The rule says that by day seven, you should have enough insight to settle. 与其跟踪信息的数量,不如跟踪你花在某项决定上的时间。假设你给自己十天时间来研究一个投资机会。这条规则说,到第七天,你应该有足够的洞察力来解决。 - **Spreadsheets and formulas.** Trackable stats like sales, views, and workload help you decide which projects to prioritize. Many entrepreneurs review their performance data once a year though. Applying the 70% suggests you do it every eight months instead. **电子表格和公式。**可追踪的统计数据,如销售额、浏览量和工作量,有助于你决定哪些项目要优先处理。虽然许多企业家每年审查一次他们的业绩数据。应用70%建议你改为每八个月做一次。 And remember, there’s no such thing as a final decision. You can always change your mind. 记住,没有最终决定这回事。你可以随时改变你的想法。 ##### “Disagree and Commit?” Back in 2016, Bezos wasn’t in favor of launching a particular show on Amazon Studios. He thought the money should go to a lesser risky project, but the content creation team stuck to their guns. 早在2016年,贝索斯并不赞成在亚马逊工作室推出某个节目。他认为这笔钱应该用于风险较小的项目,但内容创作团队坚持了自己的观点。 Instead of going through an endless cycle of arguments and counterarguments, Bezos replied: “I disagree and commit and hope it becomes the most watched thing we’ve ever made.” 贝索斯没有经历无休止的争论和反驳的循环,而是回答说。"我不同意并承诺,希望它成为我们有史以来最受关注的东西。" Bezos’ reaction wasn’t a do-whatever-you-want free card; it was a well-thought decision that saved a lot of time. After all, the team that won 11 Emmys, six Golden Globes, and three Oscars knew what they were doing. 贝索斯的反应并不是随心所欲的免费卡;它是一个深思熟虑的决定,节省了大量的时间。毕竟,这个赢得了11个艾美奖、6个金球奖和3个奥斯卡奖的团队知道他们在做什么。 “Disagree and commit,” basically means, “Hey listen. I see flaws and risks in your decision but I trust your judgment and will commit with you. No need to waste any more time on convincing me.” "不同意并承诺,"基本上意味着,"嘿,听着。我看到了你的决定中的缺陷和风险,但我相信你的判断,并将与你一起承诺。没有必要再浪费时间来说服我。" The same pattern applies when you disagree with your co-founder or a team member when they suggest a gamble that makes you wince. Of course, this doesn’t mean you have to commit to everything you disagree with. 同样的模式也适用于当你不同意你的联合创始人或团队成员提出的一个让你胆战心惊的赌博时。当然,这并不意味着你必须对所有你不同意的事情作出承诺。 Here are three situations where “disagree and commit” is most relevant. 以下是 "不同意和承诺 "最相关的三种情况。 - **When you disagree with experts.** Share your worries but turn down the volume of your skeptical voice. They’re called experts for a reason. Listen to them. **当你与专家意见相左时。**分享你的担忧,但降低你的怀疑声音的音量。他们被称为专家是有原因的。倾听他们的意见。 - **When your proposal is outvoted.** Like Bezos, don’t waste time convincing or asking people to convince you. Support your team and their choice instead. **当你的建议被否决时。**像贝佐斯一样,不要浪费时间去说服或要求人们说服你。而是支持你的团队和他们的选择。 - **When you disagree with low-risk suggestions**. Giving greenlight to tiny decisions you disagree with builds trust and inspires your team to take initiative. Even if things go wrong, you won’t lose much. **当你不同意低风险的建议时**。为你不同意的微小决定开绿灯,可以建立信任,并激励你的团队采取主动。即使事情出了差错,你也不会有什么损失。 The reverse also holds true. Whenever you have a somewhat crazy bet that’s worth pursuing, ask your partners, “Disagree and commit?” ##### The Regret Minimization Framework My most difficult decision so far has been to walk away from engineering. I gave up a comfortable salary, health insurance, validation from my family, and social status for a risky online venture. The decision came with a few sleepless nights and a ton of compulsive eating — which could’ve been avoided if I’d found Bezos’ trick before I spoke with my ex-employer. He said my idea was great for a fresh graduate but not someone with three years of consulting under his belt. Turns out Bezos and I share more than a haircut. He had a similar experience with his boss but had a better, much better way to make peace with his choice. Young Bezos overcame doubt and regret by projecting himself forward into the future. He pictured his 80-year-old self sitting on a rocking chair and looking back at his life choices. 年轻的贝索斯通过把自己投射到未来,克服了怀疑和遗憾。他想象80岁的自己坐在摇椅上,回首自己的人生选择。 “In most cases, our biggest regrets turn out to be acts of omission,” Bezos [said](https://www.inc.com/jeff-haden/jeff-bezos-ask-yourself-1-question-to-make-truly-important-decisions-and-avoid-lifelong-regrets.html). “It’s paths not taken and they haunt us.” "在大多数情况下,我们最大的遗憾变成了不作为,"贝佐斯[说](https://www.inc.com/jeff-haden/jeff-bezos-ask-yourself-1-question-to-make-truly-important-decisions-and-avoid-lifelong-regrets.html)。"是没有走的路,它们困扰着我们。" “We wonder what would have happened,” he added. “I knew that when I’m 80, I would never regret trying this thing I was super excited about [quitting a good job to start Amazon].” "我们想知道本来会发生什么,"他补充说。"我知道,当我80岁的时候,我绝不会后悔尝试我超级兴奋的这件事[辞去一份好工作,创办亚马逊]。" So whenever you’re considering a big pivot like starting over or going full-time on your side-hustle, ask yourself: > Would my 80-year-old self regret this decision? Whatever it might be for you, the answer will make your decision easier. Much easier. ##### Let’s Recap Most entrepreneurs picture decision-making as a mystical superpower that emerges from the gut. In reality, the only things that come out of your belly are gas and digested food. Decisions, on the other hand, happen in your mind. But your mind isn’t enough — you also need a reliable system. 另一方面,决策发生在你的头脑中。但你的头脑是不够的--你还需要一个可靠的系统。 That’s why legendary investor Charles Munger [uses](https://fs.blog/intellectual-giants/charlie-munger/) mental models and why Elon Musk [uses](https://nabil-alouani.medium.com/think-like-you-cook-think-like-elon-musk-30c29c41e2c2) First Principles Thinking, and why Jeff Bezos put together decision-making rules. 这就是为什么传奇投资者查尔斯-芒格[使用](https://fs.blog/intellectual-giants/charlie-munger/)心智模式,为什么埃隆-马斯克[使用](https://nabil-alouani.medium.com/think-like-you-cook-think-like-elon-musk-30c29c41e2c2)第一原理思维,以及为什么杰夫-贝索斯把决策规则放在一起。 Steal the pattern. 1. Decide as soon as you have 70% of the information you wished you had. 2. Disagree and commit with your team when they’re confident about their decision. You’ll save time and build trust. 3. When facing a life-changing decision, ask yourself: “Will my 80-year-old self version regret it?” If no, go ahead. ### The Future of CSS: Cascade Layers origin: [The Future of CSS: Cascade Layers](https://www.bram.us/2021/09/15/the-future-of-css-cascade-layers-css-at-layer/) ![img](https://raw.githubusercontent.com/Phalacrocorax/memo-image-host/master/uPic/css-cascade-cascade-layers-champ-bramus-560x315.png) > When writing CSS, we developers have to carefully think about how we write and structure our code. Without any proper *“plan of attack”* the Cascade can suddenly work against us, and we might end up with pieces of code overwriting each other, selectors getting heavier and heavier, a few `!important` modifiers here and there, … — Uhoh! ##### The CSS Cascade, a Quick Primer The [CSS Cascade](https://drafts.csswg.org/css-cascade/#cascading) is the algorithm which CSS uses to resolve competing declarations that want to be applied to an element. ```css /* HTML: */ input { color: grey; } input[type="password"] { color: hotpink !important; } #password { color: lime; } ``` To determine which declaration should “win” *(and thus be applied)*, the Cascade looks at a few criteria. Without taking Cascade Layers into account just yet, these criteria are: 1. Origin and Importance 2. Context 3. Style Attribute 4. Specificity 5. Order of Appearance *(aka Source Code Order)* These criteria are ranked from high to low priority, and are checked one after the other until a winning declaration has been determined. In case it is undecided which property declaration will “win” at a higher criterion, the Cascade will move on to the next criterion. Origin and Importantce > Context > Style Attribute > Specificity > Order of Appearance. [The CSS Cascade](https://wattenberger.com/blog/css-cascade) > The **CSS Cascade** is the way our browsers resolve competing CSS declarations. ##### Taming the Cascade When authoring CSS we place our CSS mainly into one and the same origin: the Author Origin. As a result, we end up juggling with **Selector Specificity** and **Order of Appearance** as our ways to control the cascade. While doing so, we have to perform a fine balancing act between both of these aspects: 在编写CSS的时候,我们主要把CSS放在一个相同的原点上:**Author Origin**。因此,我们最终要用**选择器的特殊性**和**外观顺序**作为我们控制级联的方法。在这样做的时候,我们必须在这两个方面进行精细的平衡。 - Statements that use selectors of a high specificity can cause problems in case you want to override some properties later in the code. This often leads to even more heavy selectors or the use of !important, which in itself can raise even more issues. 使用高特异性的选择器的语句会导致问题,以防你想在以后的代码中覆盖一些属性。这往往会导致更多的选择器或使用!"重要",这本身就会引起更多的问题。 - Statements that use selectors of a low specificity can be overwritten too easily by statements that appear later in the code. This can especially be troublesome when loading third-party CSS after your own code. 使用低特异性选择器的语句可以很容易地被代码中后来出现的语句覆盖。当在你自己的代码之后加载第三方的CSS时,这可能特别麻烦。 To help us tame those aspects of the Cascade, a few clever developers have come up with methodologies such as [BEM](https://css-tricks.com/bem-101/), [ITCSS](https://youtu.be/1OKZOV-iLj4?t=460), [OOCSS](https://www.smashingmagazine.com/2011/12/an-introduction-to-object-oriented-css-oocss/), etc. over time. These methodologies mainly lean on the following aspects: ![img](https://www.bram.us/wordpress/wp-content/uploads/2021/09/itcss.jpg) While these approaches can certainly help you strike a balance between Selector Specificity and Order of Appearance, they are not 100% closing: - The established order is never really enforced as Order of Appearance still determines things. - Selector Specificity still has the upper hand over the order of the layers ##### Introducing Cascade Layers To make this balancing act more easy, there’s a new mechanism named Cascade Layers being worked on. It’s a CSS feature led by [Miriam Suzanne](https://twitter.com/TerribleMia/) — *whom you might also know from [CSS Container Queries](https://www.bram.us/2021/03/28/css-container-queries-a-first-look-and-demo/)* — and is part of the upcoming [CSS Cascading and Inheritance Level 5 (`css-cascade-5`) Specification](https://www.w3.org/TR/css-cascade-5/). > In the same way that Origins provide a balance of power between user and author styles, Cascade Layers provide a structured way to organize and balance concerns within a single Origin. ##### Creating a Cascade Layer 1. Using the `@layer` *block* at-rule, with styles assigned immediately to it: ```css @layer reset { * { /* Poor Man's Reset */ margin: 0; padding: 0; } } ``` 2. Using the `@layer` *statement* at-rule, without any styles assigned: ```css @layer reset; ``` 3. Using @import with the `layer` keyword or `layer()` function: ```css @import(reset.css) layer(reset); ``` ##### Managing Layer Order Cascade layers are sorted by the order in which they first are declared. In the example below we create four layers: `reset`, `base`, `theme`, and `utilities`. When re-using the name of a Layer, styles will be appended to the already existing Layer. The order of the Layers remains the same, as it’s only the first appearance which determines the order. The fact that the Layer order remains the same when re-using a Layer name makes the `@layer` statement at-rule syntax darn handy. Using it, you can establish Layer Order upfront, and append all CSS later to it: 当重新使用一个图层名称时,图层顺序保持不变,这一事实使得`@layer`语句的规则语法非常方便。使用它,你可以先建立Layer顺序,然后再将所有的CSS附加到它上面。 ```css @layer reset; /* Create 1st layer named “reset” */ @layer base; /* Create 2nd layer named “base” */ @layer theme; /* Create 3rd layer named “theme” */ @layer utilities; /* Create 4th layer named “reset” */ @layer reset { /* Append to layer named “reset” */ … } @layer theme { /* Append to layer named “theme” */ … } @layer base { /* Append to layer named “base” */ … } @layer theme { /* Append to layer named “theme” */ … } ``` Heck, you can write it even shorter, using a comma-separated list of Layer Names: ```css @layer reset, base, theme, utilities; ``` ##### Cascade Layers and the Cascade In the Cascade *(the algorithm)*, Layers get a higher precedence than Specificity and Order of Appearance. So the criteria of the Cascade become this *(in order)*: 在级联*(算法)*中,层级比具体性和外观顺序更优先。因此,级联的标准是这样的*(按顺序)*: 1. Origin and Importance 2. Context 3. Style Attribute 4. **Layers** 5. Specificity 6. Order of Appearance **Once a winning declaration has been determined via Layer Order, the Cascade won’t even check Specificity or Order of Appearance for those declarations anymore. This is because Layers is a separate and higher ranked criterion of the Cascade.** > ???? Because **later-declared** Layers **always win from earlier-declared Layers**, you —as a developer— don’t need to worry about the Specificity nor Order of Appearance that is used in those other Layers: it’s the Layer Order that dictates who the winner in case of conflict is. > > This also means that you can **easily move Layers around**, knowing that their Layer Order —and not the Specificity nor Order of Appearance— will determine things. ‼️ Do note that this doesn’t mean that Specificity and Order of Appearance are no longer important. These two criteria still are, but only inside one and the same Layer. When comparing declarations between Layers, these two criteria can be ignored. #### Intermediate Summary - With Cascade Layers you can split your CSS into several layers. - Upon creating a Layer with `@layer`, you also determine the Layer Order. - Re-using Layer names will append to the already created Layer, without altering Layer Order. - When evaluating Layers, the Cascade *(the algorithm)* will have declarations placed in later-declared Layers win from declarations in early-declared Layers (i.e. *“Last Layer Wins”*). - The Cascade evaluates Layers before Specificity and Order Of Appearance. That way you no longer need to worry about these two criteria for CSS found in separate Layers, as Layer Order will already have determined the winning declaration. ##### Unlayered Styles come first in the Layer Order Styles that are not defined in a Cascade Layer will be collected in an implicit layer. This implicit layer will be positioned first in the Layer Order. ##### Naming a Layer is optional Cascade Layers can also be created without giving them a name. These are called “Anonymous Layers”. 1. Using the `@layer` *block* at-rule, with styles assigned immediately to it ```css @layer { * { /* Poor Man's Reset */ margin: 0; padding: 0; } } ``` 2. Using `@import`: ```css @import(reset.css) layer; ``` ##### Layers can be nested It’s perfectly fine to nest `@layer` statements. ```css @layer base { /* 1st Layer */ p { max-width: 70ch; }}@layer framework { /* 2nd Layer */ @layer base { /* 1st Child Layer inside 2nd Layer */ p { margin-block: 0.75em; } } @layer theme { /* 2nd Child Layer inside 2nd Layer */ p { color: #222; } }} ``` Representing the Layers as one combined tree, it would look like this: 1. `base` 2. ``` framework ``` 1. `base` 2. `theme` To refer to a Layer that is contained inside an other Layer, use it’s full name which uses the period to determine the hierarchy, e.g. `framework.theme`. To append styles to a nested Layer, you need to refer to it using this full name: ```css @layer framework.theme { /* These styles will be added to the theme layer inside the framework layer */ blockquote { color: rebeccapurple; }} ``` ##### Cascade Layers and the use of `!important` When evaluating the Origin criterion, the Cascade orders the several Origins as follows *(ranked from high to low)*: 1. *Transitions* 2. Important User-Agent 3. Important User 4. Important Author 5. *Animations* 6. Normal Author 7. Normal User 8. Normal User-Agent Because *“Normal Unlayered Styles”* implicitly go first, this also means that *“Important Unlayered Styles”* will go last then. > ???? So yes, an `!important` declaration inside your Unlayered Styles will win from an `!important` declaration inside a Layer. ##### Cascade Layers vs. Media Queries *(and other conditionals)* When a `@layer` is nested inside a Media Query (or any other conditional), and the condition does not evaluate to `true`, the `@layer` will be not be taken into account for the Layer Order. Should the Media Query/Conditional evaluate to `true` later on — because of the screen size changing for example — Layer Order will be recalculated. 当一个@layer被嵌套在一个媒体查询(或任何其他条件)中时,如果该条件没有评估为真,@layer将不会被考虑到层序中。如果媒体查询/条件在以后评估为真--例如因为屏幕尺寸的变化--层序将被重新计算。 For Example: ```css @media (min-width: 30em) { @layer layout { .title { font-size: x-large; } }}@media (prefers-color-scheme: dark) { @layer theme { .title { color: white; } }} ``` If the first Media Query matches *(based on viewport dimensions)*, then the `layout` layer will come first in the Layer Order. If only the `color-scheme` Preference Query matches, then `theme` will be the first layer. Should both match, then the Layer Order will be `layout`, `theme`. If none matches no Layers are defined. ##### Cascade Layers vs. “Name-Defining Rules” Name-Defining Rules — such as `@keyframes`, [`@scroll-timeline`](https://brm.us/scroll-linked-animations-pt1), `@font-face` — follow Layer Order as you’d expect. ##### No Interleaving of `@import`/`@namespace` and `@layer` For parsing reasons *(see [CSSWG Issue #6522](https://github.com/w3c/csswg-drafts/issues/6522))* it’s not allowed to interleave `@layer` with `@import`/`@namespace` rules. From the moment the CSS parser sees a `@layer` that follows an earlier `@import`, all subsequent `@import` rules after it will be ignored: ```css @layer default;@import url(theme.css) layer(theme);@layer components; /* ???? This @layer statement here which comes after the @import above … */@import url(default.css) layer(default); /* ❗️ … will make this @import rule (and any other that follow) be ignored. */@layer default { audio[controls] { display: block; }} ``` To counteract this, group your `@import` rules together. ```css @layer default;@import url(theme.css) layer(theme);@import url(default.css) layer(default);@layer components;@layer default { audio[controls] { display: block; }} ``` ???? **Best Practice**: Should you rely on `@import` *(which you shouldn’t, as [it’s a performance hit](https://csswizardry.com/2018/11/css-and-network-performance/#avoid-import-in-css-files))* best is to: 1. Establish a layer order upfront using `@layer` statement at-rules 2. Group your `@import`s after that 3. Append styles to already established layers using `@layer` block at-rules ```css @layer default, theme, components;@import url(theme.css) layer(theme);@import url(default.css) layer(default);@layer default { audio[controls] { display: block; }} ``` #### Browser Support I’m very happy to see that **all browser vendors are working on adding support for Cascade Layers ????**. It’s all still experimental support, but given that the spec has matured since it got first proposed in 2019, things are looking very good to see it shipped by the end of this year / early next year. ### Misc - [v2ex](https://www.v2ex.com/t/801820#reply3) | 工厂函数返回指针的原因除了提高传输效率外还有其他原因吗? - ![img](https://cdn.jsdelivr.net/gh/chaleaoch/CDN@main/images/1631614150315-1631614150297.png) - 1.指针效率高 2.为了以后拓展,比如单例,或者提前初始化,或者修改功能开放给下游 - 其实这里使用指针会降低性能,返回指针使得 Storage 逃逸到堆上,否则可以直接栈上分配内存 - [The interesting sum of three angles problem!](https://www.youtube.com/watch?v=guPXj_Ejya4) - As I get value of b as tan-1(1/2) And a=tan-1(1/3) Now a+b = 45° And c=45° - 90 degrees. The tan of the three angles are 1/3, 1/2 and 1 respectively. Now tan of (a+b) gives rise to 1. Which means a+b is 45 degrees. C is already 45. - And thus you do arctan(1/3) + arctan(1/2) + arctan(1) = 90 which is wayy faster ???? - ![image-20210915165542778](https://raw.githubusercontent.com/Phalacrocorax/memo-image-host/master/PicGo/image-20210915165542778.png) - [Do Chairs Exist?](https://www.youtube.com/watch?v=fXW-QjBsruE) - Ontology 本体论 - Gunky univese, subsctructure of subsctructure - Mereology 分体论