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
| // users-model.js - A mongoose model | |
| // | |
| // See http://mongoosejs.com/docs/models.html | |
| // for more of what you can do here. | |
| module.exports = function (app) { | |
| const mongooseClient = app.get('mongooseClient'); | |
| const user = new mongooseClient.Schema({ | |
| email: {type: String, unique: true}, | |
| username: String, | |
| roles: [String], |
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
| const { authenticate } = require('@feathersjs/authentication').hooks; | |
| const { hashPassword, protect } = require('@feathersjs/authentication-local').hooks; | |
| const gravatar = require('../../hooks/gravatar'); | |
| function customizeSocialProfile(){ | |
| return function(hook){ | |
| // console.log('===Hook', hook); | |
| console.log("===hook.data", hook.data) |
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
| const authentication = require('@feathersjs/authentication'); | |
| const jwt = require('@feathersjs/authentication-jwt'); | |
| const local = require('@feathersjs/authentication-local'); | |
| const oauth2 = require('@feathersjs/authentication-oauth2'); | |
| const Verifier = require('@feathersjs/authentication-oauth2').Verifier; | |
| const GoogleStrategy = require('passport-google-oauth20').Strategy; | |
| const FacebookStrategy = require('passport-facebook').Strategy; | |
| // const makeHandler = require('./oauth-handler'); | |
| const EmailFirstOAuth2Verifier = require('./verifier'); |
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
| class Toggle extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = {isToggleOn: true}; | |
| // This binding is necessary to make `this` work in the callback | |
| this.handleClick = this.handleClick.bind(this); | |
| } | |
| handleClick() { |
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
| class Toggle extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = {isToggleOn: true}; | |
| // This binding is necessary to make `this` work in the callback | |
| this.handleClick = this.handleClick.bind(this); | |
| } | |
| handleClick() { |
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
| 1. Call | |
| function Product(name, price) { | |
| this.name = name; | |
| this.price = price; | |
| } | |
| function Food(name, price) { | |
| Product.call(this, name, price); | |
| this.category = 'food'; | |
| } |
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
| 2. Apply | |
| var numbers = [5, 6, 2, 3, 7]; | |
| var max = Math.max.apply(null, numbers); | |
| console.log(max); | |
| // expected output: 7 | |
| var min = Math.min.apply(null, numbers); |
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
| 3. Bind | |
| this.x = 9; // this refers to global "window" object here in the browser | |
| var module = { | |
| x: 81, | |
| getX: function() { return this.x; } | |
| }; | |
| module.getX(); // 81 |
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
| // -- Firebase | |
| const Firebase = (function () { | |
| // -- Modules | |
| const D = require("Diagnostics"); | |
| const N = require("Networking"); | |
| // -- Public |
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
| // containers/app/index.test.js | |
| import App from './index.js' | |
| import { Provider } from 'react-redux' | |
| import { push, ConnectedRouter } from 'react-router-redux'; | |
| import { ApolloProvider } from 'react-apollo'; | |
| import { shallow, mount } from 'enzyme'; | |
| import store from '../../store.js' | |
| // import configureStore from '../../../configureStore'; | |
| // import createHistory from 'history/createBrowserHistory'; |