This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> | |
| <meta name="description" content="Cycle Socket Chat - khle"/> | |
| <link rel="stylesheet" href="http://fonts.googleapis.com/icon?family=Material+Icons"> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/css/materialize.min.css"> | |
| <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> | |
| <title>Cycle Socket Chat - khle</title> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| entry: './src/main.js', | |
| output: { | |
| filename: './dist/bundle.js' | |
| }, | |
| devtool: 'source-map', | |
| module: { | |
| loaders: [ | |
| { | |
| test : /.js$/, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Observable} from 'rx'; | |
| import {run} from '@cycle/core'; | |
| import {h4, h2, div, label, nav, a, makeDOMDriver} from '@cycle/dom'; | |
| import {appBar} from './appBar.js'; | |
| import {chatPane} from './chatPane.js'; | |
| import {presencePane} from './presencePane.js'; | |
| import {textEntryView} from './textEntry.js'; | |
| function view(DOMSource) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Observable} from 'rx'; | |
| import {h2, div, label, nav, a} from '@cycle/dom'; | |
| export function appBar({DOM}) { | |
| let vdom$ = Observable.of( | |
| div('navbar-fixed', [ | |
| nav([ | |
| div('nav-wrapper', [ | |
| a({className: 'brand-logo center', href: '#'}, 'Cycle Socket Chat'), | |
| ]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Observable} from 'rx'; | |
| import {h4, div, ul, li, span, p, input, label, a, i} from '@cycle/dom'; | |
| export function chatPane({DOM}) { | |
| let vdom$ = Observable.of( | |
| div([ | |
| h4('Chat Messages'), | |
| div({className: 'row'}, [ | |
| div({className: 'input-field col s10'}, [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Observable} from 'rx'; | |
| import {h4, div, table, thead, tbody, th, tr, td} from '@cycle/dom'; | |
| export function presencePane({DOM}) { | |
| let vdom$ = Observable.of( | |
| div([ | |
| h4('Active Users'), | |
| table({className: 'striped'}, [ | |
| thead([ | |
| tr([ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Observable} from 'rx'; | |
| export function textEntryIntentWithSendButtonClicked(DOMSource) { | |
| const textStream$ = DOMSource.select('#input-msg').events('keyup').map(e => e.target); | |
| const buttonClick$ = DOMSource.select('#send-btn').events('click').map(e => e.target); | |
| return {textStream$, buttonClick$}; | |
| } | |
| export function textEntryIntentWithEnterKeyPressed(DOMSource) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| import {textEntryIntentWithEnterKeyPressed} from './textEntry.js'; | |
| import {textEntryIntentWithSendButtonClicked} from './textEntry.js'; | |
| function intentWithSendButtonClicked(DOMSource) { | |
| const {textStream$, buttonClick$} = textEntryIntentWithSendButtonClicked(DOMSource); | |
| return buttonClick$.withLatestFrom(textStream$, (buttonClick, textStream) => { | |
| return textStream; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require('express'), | |
| app = express(), | |
| fs = require('fs'), | |
| aad = require('azure-ad-jwt'); | |
| app.get('/books', function(req, res) { | |
| var audience = 'http://samplewebservice.azure-mobile.net' | |
| var authorization = req.headers['authorization'] | |
| if (authorization) { | |
| var bearer = authorization.split(" "); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -X POST --data "grant_type=client_credentials&resource=https://graph.windows.net&client_id=http://samplewebservice.azure-mobile.net&client_secret=[which is also called keys in AAD portal]&scope=Directory.ReadWrite.All" https://login.microsoftonline.com/your-tenant.onmicrosoft.com/oauth2/token |