02 2016 档案
摘要:The Immutable.js Record() allows you to model your immutable data much like you would model data with native Javascript classes or objects. It differs
阅读全文
摘要:hapi automatically responds with JSON for any error passed to a route's reply()method. But what if your application needs errors rendered in HTML? Thi
阅读全文
摘要:Instead of using middlware, hapi provides a number of points during the lifecycle of a request that you can hook-in to provide additional functionalit
阅读全文
摘要:hapi makes handling POST and PUT payloads easy by buffering and parsing them automatically without requiring additional modules or middleware. This po
阅读全文
摘要:View engines, or template engines, allow you to maintain a clean separation between your presentation layer and the rest of your application. This pos
阅读全文
摘要:hapi does not support serving static files out of the box. Instead it relies on a module called Inert. This lesson will cover serving static files usi
阅读全文
摘要:When you use reply method: let resp = reply('hello world') It actually return an response object. By using response object, you can modiy the response
阅读全文
摘要:hapi's reply interface is one of it's most powerful features. It's smart enough to detect and serialize objects, buffers, promises and even streams. T
阅读全文
摘要:Routing is a fundamental aspect of any framework. In this lesson, you'll learn how to use path parameters in hapi's router. We'll also touch on how th
阅读全文
摘要:hapi doesn't ship with logging support baked in. Luckily, hapi's rich plugin ecosystem includes everything needed to configure logging for your applic
阅读全文
摘要:hapi is a rock solid server framework for Node.js. Its focus on modularity and configuration-over-convention makes it the perfect match for any size d
阅读全文
摘要:function getCompiledElement() { $scope.chart = { additional: "$ 1.56 / per minute", text: "phoneCard.voice", total: 250, unit: "MIN", used: 127 }; con
阅读全文
摘要:While Immutable.js offers .is() to confirm value equality between iterables it comes at the cost of referencing each key and value in both objects. Fo
阅读全文
摘要:Check the page:http://www.cssarrowplease.com/ In HTML: {{type}} is tow way binding in Angular, three types: text, data, voice <div class="chart-area {
阅读全文
摘要:Sometimes, the helper methods that RxJS ships with such as fromEvent, fromPromise etc don't always provide the exact values you want & you end up havi
阅读全文
摘要:Now you should have a good idea what Cycle.run does, and what the DOM Driver is. In this lesson, we will not build a toy version of Cycle.js anymore.
阅读全文
摘要:This lessons shows how we are able to easily swap our toy DOM Driver with the actual Cycle.js DOM Driver, a more solid, more flexible, more efficient
阅读全文
摘要:HTML: <ul class="list"> <li ng-repeat="item in itmes" ng-click="selectItem(item)" ng-class="{selected: item.isSelected}">{{ item.name }}</li> </ul> //
阅读全文
摘要:Understanding Immutable.js's Map() and List() structures will likely take you as far as you want to go with immutable programming. They have only smal
阅读全文
摘要:Immutable.js provides several conversion methods to migrate one structure to another. Each Immutable.js class contains a prefixed "to" method like Map
阅读全文
摘要:Immutable.js iterables offer the reduce() method, a powerful and often misunderstood functional operator on which map(), filter(), groupBy(), etc. are
阅读全文
摘要:The Immutable.js Map() is analogous to a Javascript Object or Hash since it is comprised of key-value pairs. The Immutable.js List() is analogous to a
阅读全文
摘要:Immutable.js offers the fromJS() method to build immutable structures from objects and array. Objects are converted into maps. Arrays are converted in
阅读全文
摘要:For any reason, there is an error in your code, maybe something like undefined error. Protractor still has all the test cases passing, but our applica
阅读全文
摘要:Usually we use template languages like Handlebars, JSX, and Jade to create. One simple way we can create our own template language is to write a funct
阅读全文
摘要:const stores = Immutable.List([ { name: 'Store42', position: { latitude: 61.45, longitude: 23.11, }, address: 'whatever' }, { name: 'Store2', position
阅读全文
摘要:Testing your AngularJS application on multiple browsers is important, and Protractor offers this ability through the multiCapabilities configuration o
阅读全文
摘要:Install: npm install -g elementor Then run: webdriver-manager start Lets say if we want to test 'http://angular.github.io/protractor/#/api' page: elem
阅读全文
摘要:We can use: ^: match the beginning $: match the end Let's say we have the string like the following: var str = `12/1/16 12-16-13 11/12/16 12-12-2016`;
阅读全文
摘要:ES6: If you know about the Javascirpt's event loop. You know that any asyns opreations will be throwed to the end to loop, such as 'setTimeout, http c
阅读全文
摘要:Regular Expression Backreferences provide us a method to match a previously captured pattern a second time. For example we have an string, and we want
阅读全文
摘要:Regular Expression Word Boundaries allow to perform "whole word only" searches within our source string. Imaging we have string as follow, and we want
阅读全文
摘要:Let's image tow cases for the following string: var str = `foo foobar foobaz fooboo` First of all: we know how to capture foobar or fooboo: var regex
阅读全文
摘要:We'll capture groups of characters we wish to match, use quantifiers with those groups, and use references to those groups in String.prototype.replace
阅读全文
摘要:Install: npm install ionic cordova -g Create a project with blank template: ionic start <project_name> blank Start: cd <proejct_name> ionic serve Then
阅读全文
摘要:Somtimes, the project might set the commit message guide line, if your commit doesn't meet the requirement, ghook will reject it. If you really not su
阅读全文
摘要:When you want to push your local branch to remote branch, for the first push: git push --set-upstream origin <branch_name> The reason to set 'up-strea
阅读全文
摘要:We will create an anction creator to manage the dispatch actions, to keep code maintainable and self-documenting by extracting action creators from th
阅读全文
摘要:Code to be refactored: class FilterLink extends Component { componentDidMount() { const { store } = this.context; this.unsubscribe = store.subscribe((
阅读全文
摘要:Code to be refacted: const AddTodo = (props, { store }) => { let input; return ( <div> <input ref={node => { input = node; }} /> <button onClick={() =
阅读全文
摘要:Currently in our main() function, we get click$ event. function main(sources) { const click$ = sources.DOM; const sinks = { DOM: click$ .startWith(nul
阅读全文
摘要:Our previous toy DOM Driver is still primitive. We are only able to sends strings as the textContent of the container element. We cannot yet create he
阅读全文
摘要:Learn how to use the that comes with React Redux instead of the hand-rolled implementation from the previous lesson. Code to be refactored: class Visi
阅读全文
摘要:Remove: remove the wand with the name of "Doom Bringer" from our wandscollection. db.wands.remove({name: "Doom Bringer"}) >> WriteResult({'ngRemoved':
阅读全文
摘要:When doing search function, you always need to consider about the concurrent requests. AEvent ----(6s)---> AResult ------(100ms)------- BEvent -----(1
阅读全文
摘要:Previously, we wrote the Provider component by ourself: class Provider extends Component { getChildContext() { return { store: this.props.store }; } r
阅读全文
摘要:We have to write a lot of boiler plate code to pass this chore down as a prop. But there is another way, using the advanced React feature called conte
阅读全文
摘要:n the previous lessons, we used this tool to up level variable to refer to the Redux chore. The components that access this chore, such as the contain
阅读全文
摘要:describe( 'Forgot Password: with username', ()=> { let dirElementInput; beforeEach( ()=> { // Find the input control: dirElementInput = directiveElem.
阅读全文
摘要:Our application was able to produce write effects, through sinks, and was able to receive read effects, through the DOM sources. However, the main fun
阅读全文
摘要:Clean TodoApp Component, it doesn't need to receive any props from the top level component: const TodoApp = () => ( <div> <AddTodo /> <VisibleTodoList
阅读全文
摘要:Code to be refactored: const AddTodo = ({ onAddClick }) => { let input; return ( <div> <input ref={node => { input = node; }} /> <button onClick={() =
阅读全文
摘要:Code to be refacted: const TodoList = ({ todos, onTodoClick }) => ( <ul> {todos.map(todo => <Todo key={todo.id} {...todo} onClick={() => onTodoClick(t
阅读全文
摘要:The CSS :not() selector allows us to exclude a subset of elements matched by our selector. In this example we refactor two selectors down to one using
阅读全文
摘要:So far we only had effects that write something to the external world, we are not yet reading anything from the external world into our app. This less
阅读全文
摘要:Currently the code looks like : // Logic (functional) function main() { return { DOM: Rx.Observable.timer(0, 1000) .map(i => `Seconds elapsed ${i}`),
阅读全文
摘要:How can we show one string on the DOM, and a completely different string on Console log? This lesson shows how we can make our main function return mu
阅读全文
摘要:We need to give structure to our application with logic and effects. This lessons shows how we can organize our code into two parts: main() function f
阅读全文
摘要:In this lesson we'll learn shorthands for common character classes as well as their negated forms. var str = `Afewserg, %8392 ?AWE`; var regex = /[a-z
阅读全文
摘要:Regular Expression Character Classes define a group of characters we can use in conjunction with quantifiers. var str = `cat bat mat Hat 0at ?at`; var
阅读全文
摘要:Regular Expression Quantifiers allow us to identify a repeating sequence of characters of minimum and maximum lengths. In this lesson we'll use Regula
阅读全文
摘要:The simplest use of Regular Expressions is to find a plain text pattern. In this lesson we'll look at at finding plain text patterns as well as using
阅读全文