01 2020 档案

摘要:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: The number of elements initialized in nums1 and num 阅读全文
posted @ 2020-01-30 04:10 Zhentiw 阅读(126) 评论(0) 推荐(0) 编辑
摘要:Yarn 2 is workspace aware. When you need to upgrade a package in one workspace, yarn will ask you if you want to resolve the version of the package to 阅读全文
posted @ 2020-01-27 22:14 Zhentiw 阅读(242) 评论(0) 推荐(0) 编辑
摘要:yarn dlx can be used to run packages without installing them. This is useful for packages like create-react-app and gatsby that scaffold out apps for 阅读全文
posted @ 2020-01-27 22:13 Zhentiw 阅读(237) 评论(0) 推荐(0) 编辑
摘要:This lesson goes over how to install yarn 2 through npm. To install yarn 2 globally, we use npm install -g yarn@berry Init a project: yarn init -y To 阅读全文
posted @ 2020-01-27 22:03 Zhentiw 阅读(574) 评论(0) 推荐(0) 编辑
摘要:1 . Create a directory for global packages mkdir "${HOME}/.npm-packages" 2. Tell npm where to store globally installed packages npm config set prefix 阅读全文
posted @ 2020-01-27 21:59 Zhentiw 阅读(165) 评论(0) 推荐(0) 编辑
摘要:// eslint exercise 4 (no-console) // When you're finished with this exercise, run // "npm start exercise.eslint.5" // to move on to the next exercise 阅读全文
posted @ 2020-01-23 21:25 Zhentiw 阅读(197) 评论(0) 推荐(0) 编辑
摘要:function looksLike(a, b) { return ( a && b && Object.keys(b).every(bKey => { const bVal = b[bKey] const aVal = a[bKey] if (typeof bVal 'function') { r 阅读全文
posted @ 2020-01-23 20:39 Zhentiw 阅读(168) 评论(0) 推荐(0) 编辑
摘要:// eslint exercise 1 (no-console) // When you're finished with this exercise, run // "npm start exercise.eslint.2" // to move on to the next exercise 阅读全文
posted @ 2020-01-23 20:37 Zhentiw 阅读(296) 评论(0) 推荐(0) 编辑
摘要:Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true /** * Defi 阅读全文
posted @ 2020-01-23 04:34 Zhentiw 阅读(152) 评论(0) 推荐(0) 编辑
摘要:Trying to structure the state logic of an application as a single machine can begin to become unwieldy when we have too many states. It is often bette 阅读全文
posted @ 2020-01-21 21:18 Zhentiw 阅读(413) 评论(0) 推荐(0) 编辑
摘要:We can invoke a callback as a service when we enter a state in XState. This gives us the ability to trigger various functionality by responding to eve 阅读全文
posted @ 2020-01-21 17:38 Zhentiw 阅读(627) 评论(0) 推荐(0) 编辑
摘要:Unbeknownst to many, promises are state machines. They exist in either an idle, pending, resolved or rejected state. Because they can be modeled as st 阅读全文
posted @ 2020-01-21 17:17 Zhentiw 阅读(424) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-21 03:54 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
摘要:The passing of time can be represented as an event in XState. Rather than requiring the user to send an event after an amount of time has passed, XSta 阅读全文
posted @ 2020-01-21 03:32 Zhentiw 阅读(123) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-21 03:27 Zhentiw 阅读(6) 评论(0) 推荐(0) 编辑
摘要:drcorator should be named as '<directive_name>Directive': 阅读全文
posted @ 2020-01-20 20:30 Zhentiw 阅读(104) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-20 02:15 Zhentiw 阅读(6) 评论(0) 推荐(0) 编辑
摘要:Can you walk and talk at the same time? If so, you've experienced what it's like to be in two states at the same time. Hopefully, those two states hav 阅读全文
posted @ 2020-01-20 02:04 Zhentiw 阅读(232) 评论(0) 推荐(0) 编辑
摘要:As our state machines grow more complex, we might find ourselves in a situation where a state should only exist if the machine is already in another s 阅读全文
posted @ 2020-01-19 23:07 Zhentiw 阅读(200) 评论(0) 推荐(0) 编辑
摘要:Not all transitions should be taken immediately. Occasionally, we would like to conditionally take a transition. We do this through the use of "guards 阅读全文
posted @ 2020-01-19 22:52 Zhentiw 阅读(179) 评论(0) 推荐(0) 编辑
摘要:Activities are continuous, ongoing side effects that are triggered by entering a particular state, and only stop when that state is exited. In the exa 阅读全文
posted @ 2020-01-19 22:35 Zhentiw 阅读(137) 评论(0) 推荐(0) 编辑
摘要:Consider a text input. It would be impossible for anyone to model every value you could possibly put into it, because the number of possible values is 阅读全文
posted @ 2020-01-19 22:19 Zhentiw 阅读(163) 评论(0) 推荐(0) 编辑
摘要:XState provides the send function to create an action that will send the event passed in to the machine. If we provide the second argument to the send 阅读全文
posted @ 2020-01-19 20:21 Zhentiw 阅读(311) 评论(0) 推荐(0) 编辑
摘要:Transitions come in two varieties: "external" and "internal". By default, a transition is considered external. This means that a transition will exit  阅读全文
posted @ 2020-01-19 20:11 Zhentiw 阅读(274) 评论(0) 推荐(0) 编辑
摘要:For example, we have a interface: We are using it with NestJS backend, in order to validate the request with meanful runtime error message, we can use 阅读全文
posted @ 2020-01-19 17:45 Zhentiw 阅读(263) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-19 04:27 Zhentiw 阅读(3) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-19 03:04 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-19 02:53 Zhentiw 阅读(9) 评论(0) 推荐(0) 编辑
摘要:While it's powerful enough to have Machine.transition, it can get tedious constantly passing it a state and an event. It would be nice if we had a fun 阅读全文
posted @ 2020-01-18 22:45 Zhentiw 阅读(151) 评论(0) 推荐(0) 编辑
摘要:numerating the possible states of a function is a sound way to write a function, but it is imperative and could benefit from abstraction. We can do th 阅读全文
posted @ 2020-01-18 17:35 Zhentiw 阅读(157) 评论(0) 推荐(0) 编辑
摘要:There are several fundamental problems with trying to manage the state of a function through the use of booleans. The first is often referred to as "b 阅读全文
posted @ 2020-01-18 17:11 Zhentiw 阅读(365) 评论(0) 推荐(0) 编辑
摘要:Fire and Forgot: Fire an action and not wait it complete. Fire and Wait: FIre an action and wait for result. Fire and Forgot Fire and Wait: Using `mer 阅读全文
posted @ 2020-01-17 15:55 Zhentiw 阅读(415) 评论(0) 推荐(0) 编辑
摘要:Problem: Two ways to solve the problem: 1. Change the order: 2. Using createSelector: 阅读全文
posted @ 2020-01-16 18:37 Zhentiw 阅读(162) 评论(0) 推荐(0) 编辑
摘要:When defining a selector, you can also pass other selectors into the signature of the Selector decorator to join other selectors with this state selec 阅读全文
posted @ 2020-01-16 18:31 Zhentiw 阅读(256) 评论(0) 推荐(0) 编辑
摘要:1. Selet piece of state from Store: This is useful when you just want to get state from the store directly. Of course that global state should contain 阅读全文
posted @ 2020-01-16 18:25 Zhentiw 阅读(343) 评论(0) 推荐(0) 编辑
摘要:This approach can also allow for the creation of well named helper functions that can be shared between handlers that require the same type of update. 阅读全文
posted @ 2020-01-16 17:07 Zhentiw 阅读(194) 评论(0) 推荐(0) 编辑
摘要:In general, it is not recommeded to use Namespace in Typescript, we should use ES6 module export import syntax. But there are still some good usecases 阅读全文
posted @ 2020-01-16 16:58 Zhentiw 阅读(149) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-16 02:58 Zhentiw 阅读(2) 评论(0) 推荐(0) 编辑
摘要:Fallback exception filter is mean to catch any exception which are not catched by other exception filters; main.ts: Order matters, from most generic t 阅读全文
posted @ 2020-01-15 14:29 Zhentiw 阅读(302) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-15 04:18 Zhentiw 阅读(1) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-15 04:10 Zhentiw 阅读(1) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-14 02:12 Zhentiw 阅读(1) 评论(0) 推荐(0) 编辑
摘要:We make a .env file and accidentally push it to github. In order to remove the .env file, we first have to add it to our .gitignore file - but that's 阅读全文
posted @ 2020-01-13 15:57 Zhentiw 阅读(139) 评论(0) 推荐(0) 编辑
摘要:We've made a pull request and now we can clean up the branches by deleting the feature branch. Branches are just pointers to commits - so we can safel 阅读全文
posted @ 2020-01-13 15:53 Zhentiw 阅读(147) 评论(0) 推荐(0) 编辑
摘要:Throw expection from Controller: Expection types: https://docs.nestjs.com/exception-filters#built-in-http-exceptions We can create global reuseable ex 阅读全文
posted @ 2020-01-13 14:28 Zhentiw 阅读(432) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-13 02:26 Zhentiw 阅读(2) 评论(0) 推荐(0) 编辑
摘要:main.ts Module: Schema: Controller: Repository: 阅读全文
posted @ 2020-01-12 19:51 Zhentiw 阅读(757) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-12 03:30 Zhentiw 阅读(3) 评论(0) 推荐(0) 编辑
摘要:Real forms are rarely visualized as a single column with one field below the other. Rather they often span over multiple columns to save screen space. 阅读全文
posted @ 2020-01-10 20:22 Zhentiw 阅读(744) 评论(0) 推荐(0) 编辑
摘要:Assume we want to add a data-cy attribute to all of our form controls. We need this as a hook to later be able to easily grab our input fields from wi 阅读全文
posted @ 2020-01-09 19:20 Zhentiw 阅读(561) 评论(0) 推荐(0) 编辑
摘要:In a real form you'll most likely want to add some 3rd party form controls. For example autocomplete fields, date-time pickers etc. In this lesson we' 阅读全文
posted @ 2020-01-09 18:41 Zhentiw 阅读(1277) 评论(0) 推荐(0) 编辑
摘要:Formly comes with a lot of built-in validators. Nevertheless you most likely will have to to implement some custom validation. In this lesson we're go 阅读全文
posted @ 2020-01-09 18:26 Zhentiw 阅读(829) 评论(0) 推荐(0) 编辑
摘要:When you display error messages you want to make them as understandable as possible such that the user is able to figure out the problem. Example: the 阅读全文
posted @ 2020-01-09 16:43 Zhentiw 阅读(319) 评论(0) 推荐(0) 编辑
摘要:In this lesson we're going to learn how to dynamically hide a form control with Formly's hideExpressions. These expressions are evaluated automaticall 阅读全文
posted @ 2020-01-09 16:24 Zhentiw 阅读(314) 评论(0) 推荐(0) 编辑
摘要:Formly has a nice mechanism called "expression properties". These are expressions in the form of a function callback or string expression that are eva 阅读全文
posted @ 2020-01-09 16:22 Zhentiw 阅读(970) 评论(0) 推荐(0) 编辑
摘要:Ever had to disable a form control based on the value of another form control? If your city dropdown field is filtered based on the current nation dro 阅读全文
posted @ 2020-01-09 16:16 Zhentiw 阅读(791) 评论(0) 推荐(0) 编辑
摘要:Every serious form in large apps has some dependent fields. For instance a dropdown field containing all nations and another dropdown field displaying 阅读全文
posted @ 2020-01-09 16:13 Zhentiw 阅读(2574) 评论(0) 推荐(0) 编辑
摘要:Once a commit is pushed, you do NOT want to use git reset to undo it - because reset will rewrite the history tree, and anyone who has already pulled 阅读全文
posted @ 2020-01-09 15:01 Zhentiw 阅读(144) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2020-01-09 02:18 Zhentiw 阅读(0) 评论(0) 推荐(0) 编辑
摘要:If you've removed a commit with git reset --hard, it's still possible to recover the commit using git reflog to look up the commit hash. Once we find 阅读全文
posted @ 2020-01-08 20:35 Zhentiw 阅读(131) 评论(0) 推荐(0) 编辑
摘要:git reset has three primary options that we might use: --soft, --hard and --mixed (the default). We'll use git reset to undo the latest commit in all 阅读全文
posted @ 2020-01-08 20:29 Zhentiw 阅读(113) 评论(0) 推荐(0) 编辑
摘要:Generators offer flexible alternatives to working with arrays and how you want to iterate through the data. While most scenarios are covered by the me 阅读全文
posted @ 2020-01-08 17:58 Zhentiw 阅读(136) 评论(0) 推荐(0) 编辑
摘要:Generator functions are great at generating data. You can create all types of functions that take params to define what sort of data to generate. The 阅读全文
posted @ 2020-01-08 17:01 Zhentiw 阅读(95) 评论(0) 推荐(0) 编辑
摘要:Since generators can take initial values and expose a next method which can run updates on the initial value, it becomes trivial to make a state machi 阅读全文
posted @ 2020-01-08 16:59 Zhentiw 阅读(128) 评论(0) 推荐(0) 编辑
摘要:Generators emulate the behavior of a closure where they wrap an initial value then can take subsequent values through next to yield something based on 阅读全文
posted @ 2020-01-08 16:47 Zhentiw 阅读(115) 评论(0) 推荐(0) 编辑
摘要:Generators allow you to hook together multiple generators with the yield* syntax. This allows you to branch off into many different types of iteration 阅读全文
posted @ 2020-01-08 16:30 Zhentiw 阅读(181) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示