Tutorial by Examples

A basic reducer would look like this: // Import the action types to recognise them import { ACTION_ERROR, ACTION_ENTITIES_LOADED, ACTION_ENTITY_CREATED } from './actions'; // Set up a default state const initialState = { error: undefined, entities: [] }; // If no state is provi...
Immutable is a great library that provides us with immutable versions of widely used types of collections, such as Lists, Stacks, Maps, and more. It simplifies the manipulation of the state and makes it easier to make pure calculations and avoid mutation. Let's see how the Basic reducer can be rew...
You can add a method to any class in Ruby, whether it's a builtin or not. The calling object is referenced using self. class Fixnum def plus_one self + 1 end def plus(num) self + num end def concat_one self.to_s + '1' end end 1.plus_one # => 2 3.plus(5) ...
Objective: Use SignalR for notification between Web API, and TypeScript/JavaScript based Web App, where Web API and the Web App is hosted in different domain. Enabling SignalR and CORS on Web API: Create a standard Web API project, and install the following NuGet packages: Microsoft.Owin.Cors ...
If you want to check the existence of one file or do a couple of actions for every file in a folder you can use the Foreach Loop Container. You give the path and the file mask and it will run it for every file it finds
{ "Records": [ { "eventVersion": "2.0", "eventTime": "1970-01-01T00:00:00.000Z", "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "s3": { &qu...
One of the best uses for markup extensions is for easier usage of IValueConverter. In the sample below BoolToVisibilityConverter is a value converter but since it's instance independent it can be used without the normal hasles of a value converter with the help of markup extension. In XAML just use...
There are four predefined markup extensions in XAML: x:Type supplies the Type object for the named type. This facility is used most frequently in styles and templates. <object property="{x:Type prefix:typeNameValue}" .../> x:Static produces static values. The values come from va...
I am developing a mobile app using ionic 2 with Angular 2. I have an ion-list filled ion-items. I want those ion-item to have the ability to be deleted if needed as presented here on the ionic website. However, a lot have changed in ionic 2 since the first version and the above style of one button...
To easily link your Redux store to your React components you can use an additional library: react-redux. First, you need to wrap your app in a Provider, which is a component that passes your store to be used by child components: import { Provider } from 'react-redux'; /// ... store = createStor...
After you wrapped your app into provider you can use connect function to subscribe your component to store changes and provide mapping between Redux state properties and React components' properties: import { connect } from 'react-redux'; const MyComponent = ({data}) => ( <div>{data...
First step is create navigation interface which we will use on view model: public interface IViewNavigationService { void Initialize(INavigation navigation, SuperMapper navigationMapper); Task NavigateToAsync(object navigationSource, object parameter = null); Task GoBackAsync(); } ...
var mongoose = require('mongoose'); //assume Player and Board schemas are already made var Player = mongoose.model('Player'); var Board = mongoose.model('Board'); //Each key in the schema is associated with schema type (ie. String, Number, Date, etc) var gameSchema = new mongoose.Schema({ ...
using Xunit; public class SimpleCalculatorTests { [Theory] [InlineData(0, 0, 0, true)] [InlineData(1, 1, 2, true)] [InlineData(1, 1, 3, false)] public void Add_PassMultipleParameters_VerifyExpected( int inputX, int inputY, int expected, bool isExpectedCorrect) ...
The showcase of Primefaces components you can find here and documentation is here Frontend needs to be saved as a XHTML file. This file can contain JSF, JSTL, JSP, HTML, CSS, jQuery, javaScript and its framework and more front-end technologies. Please, do not mix JSF and JSP technologies together....
Merging key names are same pd.merge(df1, df2, on='key') Merging key names are different pd.merge(df1, df2, left_on='l_key', right_on='r_key') Different types of joining pd.merge(df1, df2, on='key', how='left') Merging on multiple keys pd.merge(df1, df2, on=['key1', 'key2']) Treatment...
You'll first send the user to the Twitch authorization endpoint. This URL is made up of a the base authorization URL (https://api.twitch.tv/kraken/oauth2/authorize) and query string parameters that define what you're requesting. The required parameters are response_type, client_id, redirect_uri, and...
When the user goes to the authorization endpoint, they will be asked to give your application permission to the scopes that you've requested. They can decline this, so you must make sure to take that into consideration in your code. After they've allowed your application access, the user will be red...
Now that you have an authorization code, you can make a POST to the token endpoint (https://api.twitch.tv/kraken/oauth2/token) to get an OAuth token. You will receive a JSON-encoded access token, refresh token, and a list of the scopes approved by the user. You can now use that token to make authent...
Server syntax: var io = require('socket.io')(80); io.on('connection', function (mysocket) { //emit to all but the one who started it mysocket.broadcast.emit('user connected'); //emit to all sockets io.emit('my event', { messg: 'for all'}); }); // a javascript client would listen ...

Page 903 of 1336