Tutorial by Examples: c

This solution is more involved, leveraging custom TypeScript decorators which inject match, history and/or location data into your React.Component class, which gets you full type safety without needing any type guards, as the previous example required. // Routed.ts - defines decorators import { Ro...
Stack corruptions are annoying bugs to look at. As the stack is corrupted, the debugger often can't give you a good stack trace of where you are and how you got there. This is where safe-stack comes into play. Instead of using a single stack for your threads, it will use two: A safe stack and a dan...
Let's say we want to console.log each time the component mounts: hocLogger.js export default function hocLogger(Component) { return class extends React.Component { componentDidMount() { console.log('Hey, we are mounted!'); } render() { return <Component {...this....
Let's say we have a component that should only be displayed if the user is logged in. So we create a HOC that checks for the authentication on each render(): AuthenticatedComponent.js import React from "react"; export function requireAuthentication(Component) { return class Auth...
PageTS Settings: ## Default Image cropping ## TCEFORM.sys_file_reference.crop.config.cropVariants { default { title = Desktop selectedRatio = NaN allowedAspectRatios { NaN { title = Free value = 0.0 } ...
(defrecord Logline [datetime action user id]) (def pattern #"(\d{8}-\d{2}:\d{2}:\d{2}.\d{3})\|.*\|(\w*),(\w*),(\d*)") (defn parser [line] (if-let [[_ dt a u i] (re-find pattern line)] (->Logline dt a u i))) Define a sample line : (def sample "20170426-17:20:04...
This example shows how to embed some basic C# into a PowerShell script, add it to the runspace/session and utilise the code within PowerShell syntax. $code = " using System; namespace MyNameSpace { public class Responder { public static void StaticRespond() { ...
my.pipe.ts import { Pipe, PipeTransform } from '@angular/core'; @Pipe({name: 'myPipe'}) export class MyPipe implements PipeTransform { transform(value:any, args?: any):string { let transformedValue = value; // implement your transformation logic here return transformedValue; }...
About this Project This is simple boilerplate project. This post will guide you to set up the environment for ReactJs + Webpack + Bable. Lets get Started we will need node package manager for fire up express server and manage dependencies throughout the project. if you are new to node package man...
app.module.ts Add these into your app.module.ts file to use reactive forms import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { AppComponent } from './app.component'; @...
I found this to be the way to properly nest children routes inside the app.routing.ts or app.module.ts file (depending on your preference). This approach works when using either WebPack or SystemJS. The example below shows routes for home, home/counter, and home/counter/fetch-data. The first and l...
Router enables navigation from one view to another based on user interactions with the application. Following are the steps in implementing basic routing in Angular - NOTE: Ensure you have this tag: <base href='/'> as the first child under your head tag in your index.html file. This ele...
Create a service- import {EventEmitter} from 'angular2/core'; export class NavService { navchange: EventEmitter<number> = new EventEmitter(); constructor() {} emitNavChangeEvent(number) { this.navchange.emit(number); } getNavChangeEmitter() { return...
The following example demonstrates a simple HTTP GET request. http.get() returns an Observable which has the method subscribe. This one appends the returned data to the posts array. var posts = [] getPosts(http: Http): { this.http.get(`https://jsonplaceholder.typicode.com/posts`) ....
Folder Structure . ├── lib ├── modules | ├── misc.js | ├── someFunctions.js ├── app.js ├── index.html ├── package.json ├── webpack.config.js └── webserver.js package.json { "name": "webpack-example-with-nodejs", "version": "1.0.0", ...
This is a just a simple example of how to use GooglePlay Service's ActivityRecognitionApi. Although this is a great library, it does not work on devices that do not have Google Play Services installed. Docs for ActivityRecognition API Manifest <!-- This is needed to use Activity Recognition! -...
PathSense activity recognition is another good library for devices which don't have Google Play Services, as they have built their own activity recognition model, but requires developers register at http://developer.pathsense.com to get an API key and Client ID. Manifest <application andro...
Add repository repositories { maven { url "https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/" } } Add in Project Gradle for Chat Functionality dependencies { compile("com.quickblox:quickblox-android-sdk-chat:2.6.1&...
To initialise chat service use: QBChatService.setDebugEnabled(true); // enable chat logging QBChatService.setDefaultPacketReplyTimeout(10000);//set reply timeout in milliseconds for connection's packet. Can be used for events like login, join to dialog to increase waiting response time from ...
Create session with User & Sign In to QuickBlox Chat // Initialise Chat service QBChatService chatService = QBChatService.getInstance(); final QBUser user = new QBUser("garrysantos", "garrysantospass"); QBAuth.createSession(user, new QBEntityCallback<QBSession>()...

Page 764 of 826