01 2019 档案

摘要:When we start to accumulate functions that all work on a given datatype, we end up creating a bunch of boilerplate code in almost every function to ha 阅读全文
posted @ 2019-01-31 20:24 Zhentiw 阅读(190) 评论(0) 推荐(0) 编辑
摘要:When building our stateful computations, there will come a time when we’ll need to combine two or more state transactions at the same time to come up 阅读全文
posted @ 2019-01-31 19:39 Zhentiw 阅读(371) 评论(0) 推荐(0) 编辑
摘要:Creating Markdown files from a template is a straightforward process with Node.js and Mustache. You can define a template, load it into your script, t 阅读全文
posted @ 2019-01-31 19:06 Zhentiw 阅读(245) 评论(0) 推荐(0) 编辑
摘要:Extracting away the implementation details of ngrx from your components using the facade pattern creates some interesting possibilities in terms of it 阅读全文
posted @ 2019-01-31 00:05 Zhentiw 阅读(400) 评论(0) 推荐(0) 编辑
摘要:Communicating with a remote server via HTTP presents an extra level of complexity as there is an increased chance of race conditions and the need for 阅读全文
posted @ 2019-01-30 23:50 Zhentiw 阅读(451) 评论(0) 推荐(0) 编辑
摘要:As you refactor and modify applications, it's difficult to manage and keep track of files as they become unused. Keeping this "dead" code around adds 阅读全文
posted @ 2019-01-30 18:40 Zhentiw 阅读(992) 评论(0) 推荐(0) 编辑
摘要:We explore a means to represent the combination of our stateful computations using familiar composition. We dive into what makes this possible by talk 阅读全文
posted @ 2019-01-30 16:54 Zhentiw 阅读(289) 评论(0) 推荐(0) 编辑
摘要:The true power of the State ADT really shows when we start combining our discrete, stateful transactions. We start looking at another construction hel 阅读全文
posted @ 2019-01-30 16:40 Zhentiw 阅读(149) 评论(0) 推荐(0) 编辑
摘要:A balanced binary tree is something that is used very commonly in analysis of computer science algorithms. In this lesson we cover how to determine th 阅读全文
posted @ 2019-01-30 16:03 Zhentiw 阅读(227) 评论(0) 推荐(0) 编辑
摘要:AfterContentChecked & AfterViewChecked are called after 'OnChanges' lifecycle. And each time 'ngOnChanges' triggered, ngAfterContentChecked and ngAfte 阅读全文
posted @ 2019-01-30 15:46 Zhentiw 阅读(1025) 评论(0) 推荐(0) 编辑
摘要:Shuffling is a common process used with randomizing the order for a deck of cards. The key property for a perfect shuffle is that each item should hav 阅读全文
posted @ 2019-01-29 19:59 Zhentiw 阅读(276) 评论(0) 推荐(0) 编辑
摘要:The DOM can be a bit tricky when it comes to typing. You never really know exactly what you're going to get, so you have to educate your codebase into 阅读全文
posted @ 2019-01-29 19:14 Zhentiw 阅读(571) 评论(0) 推荐(1) 编辑
摘要:TypeScript can help you with your plain JavaScript files if you add a simple //@ts-check comment. Then you can enhance the experience by add proper JS 阅读全文
posted @ 2019-01-29 19:04 Zhentiw 阅读(391) 评论(0) 推荐(0) 编辑
摘要:1. ngOnChanges is called before ngOnInit but after constructor() 2. ngOnChanges is called because of @Input() obj, obj's reference changes. If you mut 阅读全文
posted @ 2019-01-29 18:56 Zhentiw 阅读(184) 评论(0) 推荐(0) 编辑
摘要:Recentlly, I am learning crocks.js ADT libaray. In the beginning, it is hard to understand when to use 'runWith', 'evalWith', 'execWith'. Until I went 阅读全文
posted @ 2019-01-29 17:22 Zhentiw 阅读(210) 评论(0) 推荐(0) 编辑
摘要:Using put to update our state for a given state transaction can make it difficult to modify a given state based on its previous value. In this lesson 阅读全文
posted @ 2019-01-29 17:13 Zhentiw 阅读(136) 评论(0) 推荐(0) 编辑
摘要:Stateful computations require the ability for their state to change overtime. We take a look on one way to replace the state portion of our stateful d 阅读全文
posted @ 2019-01-29 16:36 Zhentiw 阅读(183) 评论(0) 推荐(0) 编辑
摘要:We take a closer look at the get construction helper and see how we can use it to lift a function that maps the state portion and updates the resultan 阅读全文
posted @ 2019-01-29 16:15 Zhentiw 阅读(142) 评论(0) 推荐(0) 编辑
摘要:We explore our first stateful transaction, by devising a means to echo our state value into the resultant for independent modification. With our state 阅读全文
posted @ 2019-01-29 01:10 Zhentiw 阅读(158) 评论(0) 推荐(0) 编辑
摘要:Each component has its own ChangeDetectorRef, and we can inject ChangeDetectorRef into constructor: For example if you have a huge list can be updated 阅读全文
posted @ 2019-01-28 19:22 Zhentiw 阅读(383) 评论(0) 推荐(0) 编辑
摘要:TO get started with TypeScirpt quickly in your local computer is using parcel-bunlder: Create a index.html: Create a index.ts, put whatever you want. 阅读全文
posted @ 2019-01-28 15:45 Zhentiw 阅读(203) 评论(0) 推荐(0) 编辑
摘要:Decorators are a powerful feature of TypeScript that allow for efficient and readable abstractions when used correctly. In this lesson we will look at 阅读全文
posted @ 2019-01-27 22:30 Zhentiw 阅读(441) 评论(0) 推荐(0) 编辑
摘要:Sometimes you are one or two lines short from finding the cause of the error in the stack trace but you can't because Nodejs displays only a handful o 阅读全文
posted @ 2019-01-25 20:32 Zhentiw 阅读(277) 评论(0) 推荐(0) 编辑
摘要:We will look at how we can use mapped types, conditional types, self-referencing types and the “infer” keyword to create a reusable generic type that 阅读全文
posted @ 2019-01-25 20:13 Zhentiw 阅读(290) 评论(0) 推荐(0) 编辑
摘要:When we pass value to a component, normally we use @Input. Angular will check whether any update on @Input on each event fires in order to keep DOM up 阅读全文
posted @ 2019-01-25 17:09 Zhentiw 阅读(168) 评论(0) 推荐(0) 编辑
摘要:When working with conditionals types, within the “extends” expression, we can use the “infer” keyword to either get the type of the elements of an arr 阅读全文
posted @ 2019-01-24 20:15 Zhentiw 阅读(845) 评论(0) 推荐(0) 编辑
摘要:When you need to generate a data set, a generator function is often the correct solution. A generator function is defined with function* and then you  阅读全文
posted @ 2019-01-23 21:36 Zhentiw 阅读(125) 评论(0) 推荐(0) 编辑
摘要:A Javascript Proxy object is a very interesting es6 feature, that allows you to determine behaviors whenever a property is accessed in a target object 阅读全文
posted @ 2019-01-23 21:18 Zhentiw 阅读(260) 评论(0) 推荐(0) 编辑
摘要:As a beginner of Crocks.js, it was a problem for we to figure out when to use .map() and when to use .chain(). Of course, using the docs help: map: St 阅读全文
posted @ 2019-01-23 17:13 Zhentiw 阅读(427) 评论(0) 推荐(0) 编辑
摘要:For example we have: develop branch hotfix branch release branch 'develop' branch has all the latest commits and features; 'release' branch is far beh 阅读全文
posted @ 2019-01-23 15:44 Zhentiw 阅读(191) 评论(0) 推荐(0) 编辑
摘要:To create a Stateful widget: 1. Create a StatefulWidget 2. Create a State 阅读全文
posted @ 2019-01-23 03:37 Zhentiw 阅读(262) 评论(0) 推荐(0) 编辑
摘要:We have the ability to select a single random card from a pile of twelve cards, but we would like to pull a total of nine. Not only that, we would lik 阅读全文
posted @ 2019-01-22 21:38 Zhentiw 阅读(280) 评论(0) 推荐(0) 编辑
摘要:Conditional types take generics one step further and allow you to test for a specific condition, based on which the final type will be determined. We 阅读全文
posted @ 2019-01-22 21:01 Zhentiw 阅读(368) 评论(0) 推荐(0) 编辑
摘要:The "any" type can be very useful, especially when adding types to an existing JavaScript codebase, but it can also lead to lots of runtime errors, as 阅读全文
posted @ 2019-01-21 21:17 Zhentiw 阅读(359) 评论(0) 推荐(0) 编辑
摘要:Very differently to AngularJS (v1.x), Angular now has a hierarchical dependency injector. That allows to specify service definitions as well as the se 阅读全文
posted @ 2019-01-21 16:53 Zhentiw 阅读(1035) 评论(0) 推荐(0) 编辑
摘要:In this lesson we’ll learn how to import widgets we’ve created in other files & use them in our project. We'll also look at how to create dynamic prop 阅读全文
posted @ 2019-01-21 16:46 Zhentiw 阅读(905) 评论(0) 推荐(0) 编辑
摘要:When we create a Service, Angluar CLI will helps us to add: It only create a instance in root dependency tree. If there is no reference to use this pr 阅读全文
posted @ 2019-01-21 16:28 Zhentiw 阅读(222) 评论(0) 推荐(0) 编辑
摘要:We usually think of types as something that can define a single layer of an object: with an interface we normally specify a list of a few properties a 阅读全文
posted @ 2019-01-21 02:57 Zhentiw 阅读(374) 评论(0) 推荐(0) 编辑
摘要:Javascript's Object.assign is shadow merge, loadsh's _.merge is deep merge, but has probem for array. We can use Ramda.js to easy solve the problem: T 阅读全文
posted @ 2019-01-18 21:04 Zhentiw 阅读(418) 评论(0) 推荐(0) 编辑
摘要:If you're a library author, it's useful to expose your public types as interfaces, to allow your consumers to extend them if needed. For example: To r 阅读全文
posted @ 2019-01-18 19:18 Zhentiw 阅读(191) 评论(0) 推荐(0) 编辑
摘要:Functor composition is a powerful concept that arises when we have one Functor nested in another Functor. It becomes even more powerful when both of t 阅读全文
posted @ 2019-01-18 17:52 Zhentiw 阅读(228) 评论(0) 推荐(0) 编辑
摘要:We want to be able to pick nine random cards from an array of twelve cards, but can run into problems of keeping both the cards already draw and the c 阅读全文
posted @ 2019-01-17 21:47 Zhentiw 阅读(188) 评论(0) 推荐(0) 编辑
摘要:Using the optional “+” sign together with mapped type modifiers, we can create more explicit and readable type declarations. We can also use the “-” ( 阅读全文
posted @ 2019-01-17 19:46 Zhentiw 阅读(301) 评论(0) 推荐(0) 编辑
摘要:JPA is just like a helper class for providing data for Controller, has method like 'findOne', 'findAll', 'saveAndFlush', 'delete'. in repository/Shipw 阅读全文
posted @ 2019-01-16 20:53 Zhentiw 阅读(416) 评论(0) 推荐(0) 编辑
摘要:Just like the State ADT an Array is also an Applicative Functor. That means we can do the same tricks with liftA2 with Array that we have been doing w 阅读全文
posted @ 2019-01-16 16:30 Zhentiw 阅读(708) 评论(0) 推荐(0) 编辑
摘要:Custom elements are fun technology. In this video, you will learn how to set one up and running in less than 2 minutes. You'll learn how to create a C 阅读全文
posted @ 2019-01-16 15:54 Zhentiw 阅读(173) 评论(0) 推荐(0) 编辑
摘要:In JavaScript, we often end up composing one object out of several other objects. Luckily there's a convenient spread operator which allows us to spre 阅读全文
posted @ 2019-01-16 15:45 Zhentiw 阅读(150) 评论(0) 推荐(0) 编辑
摘要:Sometimes we might want to make a function more generic by having it accept a union of different types as an argument. Using the JavaScript “in” opera 阅读全文
posted @ 2019-01-15 20:47 Zhentiw 阅读(191) 评论(0) 推荐(0) 编辑
摘要:The resultant in a State ADT instance can be used as a means of communication between different stateful transactions. It can be used to read and tran 阅读全文
posted @ 2019-01-15 20:24 Zhentiw 阅读(217) 评论(0) 推荐(0) 编辑
摘要:We need our data persistence with configuring our datasouce: In application.properties: " " tells to save the in memory data into a file called 'gs-sp 阅读全文
posted @ 2019-01-14 21:55 Zhentiw 阅读(202) 评论(0) 推荐(0) 编辑
摘要:In pom.xml add dependency: Then in application.properties: Now, in the broswer, we can access h2 database though url: localhost:8080/h2 阅读全文
posted @ 2019-01-14 21:44 Zhentiw 阅读(178) 评论(0) 推荐(0) 编辑
摘要:We can use different application properties application.properties: application-prod.properties: application-test.properties: We can setup different p 阅读全文
posted @ 2019-01-14 21:30 Zhentiw 阅读(126) 评论(0) 推荐(0) 编辑
摘要:Controller: Code below shows a basic Controller to handle GET, POST; DELETE, PUT requests. Model: Im memory data: This is just a mock data. package he 阅读全文
posted @ 2019-01-14 20:32 Zhentiw 阅读(328) 评论(0) 推荐(0) 编辑
摘要:When combining multiple State ADT instances that depend on the same input, using chain can become quite burdensome. We end up having to play leapfrog 阅读全文
posted @ 2019-01-14 19:36 Zhentiw 阅读(175) 评论(0) 推荐(0) 编辑
摘要:By setting the strictPropertyInitialization flag in the .tsconfig file, TypeScript will start throwing errors unless we initialize all properties of c 阅读全文
posted @ 2019-01-14 19:21 Zhentiw 阅读(446) 评论(0) 推荐(0) 编辑
摘要:When looking at large numbers in code (such as 1800000) it’s oftentimes difficult for the human eye to quickly see how big the number actually is. Typ 阅读全文
posted @ 2019-01-14 16:45 Zhentiw 阅读(146) 评论(0) 推荐(0) 编辑
摘要:We sometimes just want to return a couple of elements next to one another from a React functional component, without adding a wrapper component which 阅读全文
posted @ 2019-01-13 18:06 Zhentiw 阅读(224) 评论(0) 推荐(0) 编辑
摘要:With GraphQL, every field and nested object can have a set of arguments which can be used to request very specific data from a GraphQL API. In this le 阅读全文
posted @ 2019-01-12 23:14 Zhentiw 阅读(278) 评论(0) 推荐(0) 编辑
摘要:A GraphQL fragment encapsulates a collection of fields that can be included in queries. In this video, we'll look at how to create fragments on types 阅读全文
posted @ 2019-01-12 23:07 Zhentiw 阅读(219) 评论(0) 推荐(0) 编辑
摘要:While sometimes outside input can have influence on how a given stateful transaction transitions, there are many times where the current state at the 阅读全文
posted @ 2019-01-11 20:31 Zhentiw 阅读(155) 评论(0) 推荐(0) 编辑
摘要:Get started with apollo server with node.js: Install: index.js: 阅读全文
posted @ 2019-01-11 16:16 Zhentiw 阅读(157) 评论(0) 推荐(0) 编辑
摘要:Many times we need to access and transform state, either in part or in full, to be used when calculating other state transitions. We will look at how 阅读全文
posted @ 2019-01-09 21:31 Zhentiw 阅读(182) 评论(0) 推荐(0) 编辑
摘要:State is a lazy datatype and as such we can combine many simple transitions into one very complex one. This gives us a lot of control over how our sta 阅读全文
posted @ 2019-01-08 21:25 Zhentiw 阅读(118) 评论(0) 推荐(0) 编辑
摘要:It's important that our users enjoy using our application or website. One way we can make it happen is by adding microinteractions to subtly reward ou 阅读全文
posted @ 2019-01-08 20:42 Zhentiw 阅读(222) 评论(0) 推荐(0) 编辑
摘要:For example we have a component: And a driective: We want to get the driective instant inside the component code, we can use @ViewChild: Then we can a 阅读全文
posted @ 2019-01-08 16:01 Zhentiw 阅读(232) 评论(0) 推荐(0) 编辑
摘要:One integer takes 32bit in memory, 1 byte = 8bits, therefore one integer takes 4 bytes. Now let's assume we have an array: [1,2,3] 4bytes . 4bytes . 4 阅读全文
posted @ 2019-01-08 03:50 Zhentiw 阅读(99) 评论(0) 推荐(0) 编辑
摘要:When developing a Finite State Machine, it is often necessary to apply multiple transitions in tandem. To accomplish this in most Redux work flows req 阅读全文
posted @ 2019-01-07 19:22 Zhentiw 阅读(267) 评论(0) 推荐(0) 编辑
摘要:Source: https://blog.angularindepth.com/debug-angular-apps-in-production-without-revealing-source-maps-ab4a235edd85 Build application with source map: 阅读全文
posted @ 2019-01-07 18:53 Zhentiw 阅读(334) 评论(0) 推荐(0) 编辑
摘要:To query a GraphQL API, all you need to do is send an HTTP request that includes the query operation in the body of the request. In this lesson, we wi 阅读全文
posted @ 2019-01-07 18:35 Zhentiw 阅读(432) 评论(0) 推荐(0) 编辑
摘要:We build our first state transactions as two discrete transactions, each working on a specific portion of the state. Each of these transitions are gov 阅读全文
posted @ 2019-01-07 16:54 Zhentiw 阅读(118) 评论(0) 推荐(0) 编辑
摘要:Naive solution for this problem would be caluclate all the possible combinations: The maximum subarray problem is one of the nicest examples of dynami 阅读全文
posted @ 2019-01-06 03:57 Zhentiw 阅读(214) 评论(0) 推荐(0) 编辑
摘要:To make an array uniqued, we can use Set() from Javascript. const ary = ["a", "b", "c", "a", "d", "c"]; console.log(new Set(ary)); We can see that all 阅读全文
posted @ 2019-01-04 23:11 Zhentiw 阅读(146) 评论(0) 推荐(0) 编辑
摘要:The median maintenance problem is a common programming challenge presented in software engineering job interviews. In this lesson we cover an example 阅读全文
posted @ 2019-01-04 20:13 Zhentiw 阅读(494) 评论(0) 推荐(0) 编辑
摘要:It's common to setup Webpack aliases to make imports much more convenient, but then you lose the ability to navigate and autocomplete paths in VS Code 阅读全文
posted @ 2019-01-04 16:36 Zhentiw 阅读(304) 评论(0) 推荐(0) 编辑
摘要:Command-line tools can help you with all sorts of tasks. This lesson covers the very basics of setting up a CLI tool in Node.js by creating your proje 阅读全文
posted @ 2019-01-04 16:16 Zhentiw 阅读(393) 评论(0) 推荐(0) 编辑
摘要:Sometimes when writing a unit test, you know that the module you're testing imports a module that you would like to observe, or at the very least mock 阅读全文
posted @ 2019-01-03 18:10 Zhentiw 阅读(394) 评论(0) 推荐(0) 编辑
摘要:In this lesson, you will learn how to iteratively generate CSS selectors and attributes using Sass loops. We will create a gradient of 100 elements, e 阅读全文
posted @ 2019-01-03 02:46 Zhentiw 阅读(154) 评论(0) 推荐(0) 编辑
摘要:Source, git Heap is a data structure that can fundamentally change the performance of fairly common algorithms in Computer Science. The heap data stru 阅读全文
posted @ 2019-01-02 20:26 Zhentiw 阅读(865) 评论(0) 推荐(0) 编辑
摘要:Your page is showing high CPU usage and spinning up your laptop fan, but nothing is visibly happening. What is it doing, and why is it so slow? This l 阅读全文
posted @ 2019-01-02 16:19 Zhentiw 阅读(192) 评论(0) 推荐(0) 编辑
摘要:Now by Zeit has recently been updated and now supports multi-language monorepos. In this lesson we'll build and deploy a simple app with an API powere 阅读全文
posted @ 2019-01-02 15:45 Zhentiw 阅读(227) 评论(0) 推荐(0) 编辑
摘要:On Android and in Chrome (but not on iOS), it's possible to send push notifications with a PWA. We'll start by asking the user for permission to send 阅读全文
posted @ 2019-01-02 03:28 Zhentiw 阅读(818) 评论(0) 推荐(0) 编辑
摘要:Let's say we have two strings: str1 = 'ACDEB' str2 = 'AEBC' We need to find the longest common subsequence, which in this case should be 'AEB'. Using 阅读全文
posted @ 2019-01-01 23:01 Zhentiw 阅读(246) 评论(0) 推荐(0) 编辑

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