10 2017 档案
摘要:Install: Basic example: Advanced example: Component:
阅读全文
摘要:Always treat Router as the source of truth When we use Ngrx, we can see that we will use a "StoreRouterConnectingModule" from the example app. What it
阅读全文
摘要:Most of time, we get used to use class name as a selector in the test. But one problem for this is classname is used for styling, when we also use it
阅读全文
摘要:/* list of strings */ let _ = ["example-1", "example-2", "example-3"]; /* Array of strings */ let _ = [|"example-1", "example-2", "example-3"|]; /* Stating the type of a Reason record */ type event...
阅读全文
摘要:// ::country is named param // ::country=?: which make it optional // because we make ::country=? optional named param, we may pass in or may not pass in // we need use '()' --> (): string => , which...
阅读全文
摘要:For example, we want to use moment.js inside our ReasonML code. What we can do is create a module file: Using it inside component:
阅读全文
摘要:Register a account on https://console.dialogflow.com/api-client/ "Creat a intent" -- you can custom your message here. "Small Talks" -- the default me
阅读全文
摘要:The upload class will be used in the service layer. Notice it has a constructor for file attribute, which has a type of File. This will allows us to i
阅读全文
摘要:User input validation is a core part of creating proper HTML forms. Form validators not only help you to get better quality data but they also guide t
阅读全文
摘要:Updated to AngularFire2 v5.0. One important change is that you need to call .snapshotChanges() or .valueChanges() to get data as Observable back. The
阅读全文
摘要:In certain situations, you care more about the final state of the redux store than you do about the particular stream of events coming out of an epic.
阅读全文
摘要:Often in unit tests we are focussing on the logic involved in crafting a network request, & how we respond to the result. The external service is unli
阅读全文
摘要:Epics can be unit-tested just like any other function in your application - they have a very specific set of inputs (the action$ stream) and the outpu
阅读全文
摘要:With redux-observable, we have the power of RxJS at our disposal - this means tasks that would otherwise be complicated and imperative, become simple
阅读全文
摘要:Imaging you are building a Tabs component. If looks like: You want to know which tab is clicked (actived). But you don't want this actived tab state b
阅读全文
摘要:In this lesson we create a new Express web server app for handling file uploads and persisting them to the filesystem. We will walk through using the
阅读全文
摘要:def myfunc(x, y, z): print(x, y, z) tuple_vec = (1, 0, 1) dict_vec = {'x': 1, 'y': 0, 'z': 1} >>> myfunc(*tuple_vec) 1, 0, 1 >>> myfunc(**dict_vec) 1, 0, 1
阅读全文
摘要:The way to test router componet needs a little bit setup, first we need to create a "router-stubs.ts". This file is a helper file. The component we wa
阅读全文
摘要:Both what "TestBed.get" & "injector" trying to do is get service for the test component. But there is some diffenece which determined when use which.
阅读全文
摘要:When you testing Component rendering, you often needs to call: For example: You can also set auto change detection: Add to providers: Tests wit auto c
阅读全文
摘要:When using Ngrx, we need to know how to test the component which has Router injected. Component: One thing we can test just for component wihtout temp
阅读全文
摘要:More detail check LInk. Render Prop vs HOC: HOC version for withMouse: Problems: Indirection. We still have the same problem with indirection that we
阅读全文
摘要:class Toggle extends Component { static propTypes = { defaultOn: PropTypes.bool, on: PropTypes.bool, onToggle: PropTypes.func, children: PropTypes.oneOfType([ PropTypes.func, ...
阅读全文
摘要:# Why Python is Great: Namedtuples # Using namedtuple is way shorter than # defining a class manually: >>> from collections import namedtuple >>> Car = namedtup1e('Car', 'color mileage') # Our new "...
阅读全文
摘要:Tf-idf, or term frequency-inverse document frequency, is a statistic that indicates how important a word is to the entire document. This lesson will e
阅读全文
摘要:In this lesson, we will learn how to train a Naive Bayes classifier and a Logistic Regression classifier - basic machine learning algorithms - on JSON
阅读全文
摘要:In this lesson, we will learn how to train a Naive Bayes classifier or a Logistic Regression classifier - basic machine learning algorithms - in order
阅读全文
摘要: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
阅读全文
摘要:A common interview question is to write a
function
that
converts a string
into
an
integer e.g. "123" => 123. This function is commonly called atoi bec
阅读全文
摘要:In a doubly linked list each node in the list stores the contents of the node and a pointer or reference to the next and the previous nodes in the lis
阅读全文
摘要:In a singly linked list each node in the list stores the contents of the node and a reference (or pointer in some languages) to the next node in the l
阅读全文
摘要:# The get() method on dicts # and its "default" argument name_for_userid = { 382: "Alice", 590: "Bob", 951: "Dilbert", } def greeting(userid): return "Hi %s!" % name_for_userid.get(...
阅读全文