Skip to content

Instantly share code, notes, and snippets.

View divyanshu013's full-sized avatar
:shipit:
Ship it

Divyanshu Maithani divyanshu013

:shipit:
Ship it
View GitHub Profile
@divyanshu013
divyanshu013 / theme.js
Last active March 6, 2018 16:49
Colors and Fonts for GitXplore app
const theme = {
typography: {
fontFamily: 'Raleway, Helvetica, sans-serif',
},
colors: {
primaryColor: '#008000',
titleColor: 'white'
},
secondaryColor: 'mediumseagreen',
};
@divyanshu013
divyanshu013 / .hyper.js
Created December 13, 2017 15:29
My hyper config
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
@divyanshu013
divyanshu013 / index.js
Created November 22, 2017 19:03
TodoMVC authorization app server side code
const express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');
const morgan = require('morgan');
const jwt = require('express-jwt');
const jwksRsa = require('jwks-rsa');
const jwtAuthz = require('express-jwt-authz');
const Appbase = require('appbase-js');
const fetch = require('node-fetch');
@divyanshu013
divyanshu013 / todoList.js
Last active November 27, 2017 09:58
TodoList component for TodoMVC authorization app
import React, { Component } from 'react';
import TodoItem from "./todoItem";
import TodoFooter from "./todoFooter";
const ALL_TODOS = "all";
const ACTIVE_TODOS = "active";
const COMPLETED_TODOS = "completed";
class TodoList extends Component {
@divyanshu013
divyanshu013 / todoApp.js
Last active November 27, 2017 09:52
TodoApp component for TodoMVC Authorization example
import React, { Component } from "react";
import {
ReactiveBase,
ReactiveList,
TextField,
DataController
} from "@appbaseio/reactivesearch";
import Utils from "./utils";
import TodoList from "./todoList";
@divyanshu013
divyanshu013 / todoModel.js
Last active November 27, 2017 09:50
Todo Model for TodoMVC Auhorization app
import Appbase from "appbase-js";
import Utils from "./utils";
import Auth from './auth';
const ES_TYPE = "todo_reactjs";
const auth = new Auth();
const headers = () => ({
'Content-Type': 'application/json',
@divyanshu013
divyanshu013 / auth.js
Created November 22, 2017 15:07
Authentication service for TodoMVC authorization app
import auth0 from 'auth0-js';
import history from './history';
export default class Auth {
requestedScopes = 'openid profile email read:todos write:todos';
// Please use your own credentials here
auth0 = new auth0.WebAuth({
domain: 'divyanshu.auth0.com',
clientID: 'IcVGTI2AUvc49lnE0ltVemretrsI3y3P',
@divyanshu013
divyanshu013 / history.js
Created November 22, 2017 12:55
History service for TodoMVC Authorization App
import createHistory from 'history/createBrowserHistory';
export default createHistory({
basename: process.env.NODE_ENV === 'development' ? '/' : '/todomvc-authorization-client'
});
@divyanshu013
divyanshu013 / todoModel.js
Created October 11, 2017 10:03
todoModel for TodoMVC Auth Client
import Appbase from "appbase-js";
import Utils from "./utils";
import Auth from './auth';
const ES_TYPE = "todo_reactjs";
const auth = new Auth();
const headers = () => ({
'Content-Type': 'application/json',
@divyanshu013
divyanshu013 / index.js
Created October 11, 2017 09:54
Final index.js file with routes and handleAuthentication for TodoMVC Auth Client
import React from 'react';
import ReactDOM from 'react-dom';
import { Route, Router } from 'react-router-dom';
import TodoModel from './todoModel';
import TodoApp from './todoApp';
import Callback from './Callback';
import Auth from './auth';
import history from './history';