This file contains 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 React, { Component } from 'react' | |
import { BrowserRouter, Route, Redirect, Switch } from 'react-router-dom' | |
import Notifications from 'react-notify-toast' | |
import 'react-toastify/dist/ReactToastify.css' | |
import Landing from './components/Landing' | |
import Confirm from './components/Confirm' | |
import Spinner from './components/Spinner' | |
import Footer from './components/Footer/Footer' | |
import { API_URL } from './config' |
This file contains 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 { CLIENT_ORIGIN } = require('../config') | |
// This file is exporting an Object with a single key/value pair. | |
// However, because this is not a part of the logic of the application | |
// it makes sense to abstract it to another file. Plus, it is now easily | |
// extensible if the application needs to send different email templates | |
// (eg. unsubscribe) in the future. | |
module.exports = { | |
confirm: id => ({ |
This file contains 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
// Inside onChange handler | |
// .... | |
// #1 There are too many files! | |
if (files.length > 3) { | |
const msg = 'Only 3 images can be uploaded at a time' | |
return this.toast(msg, 'custom', 2000, toastColor) | |
} | |
const types = ['image/png', 'image/jpeg', 'image/gif'] |
This file contains 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
arr.reduce(callback(accumulator, currentValue[, index[, array]]), [, initialValue]) |
This file contains 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
Array.prototype.myReduce = function(callback, initialValue) { | |
const arr = arguments.length > 1 | |
? [initialValue, ...this] | |
: this | |
let accumulator = arr[0] | |
for (let i = 1; i < arr.length; i++) { | |
accumulator = callback(accumulator, arr[i], i, this) | |
} |
This file contains 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
Array.prototype.myMap = function(callback) { | |
const arr = [] | |
for (let i = 0; i < this.length; i++) { | |
arr.push(callback(this[i], i , this)) | |
} | |
return arr | |
} |
This file contains 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
Array.prototype.myFilter = function(callback) { | |
const arr = [] | |
for (let i = 0; i < this.length; i++) { | |
const item = this[i] | |
if(callback(item, i, this)) { | |
arr.push(item) | |
} | |
} |
This file contains 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 express = require('express') | |
const http = require('http') | |
const passport = require('passport') | |
const session = require('express-session') | |
const cors = require('cors') | |
const socketio = require('socket.io') | |
const { Strategy: TwitterStrategy } = require('passport-twitter') | |
// Private api keys that you will get when registering an app on | |
// apps.twitter.com |
This file contains 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 React, { Component } from 'react' | |
import io from 'socket.io-client' | |
import jwtDecode from 'jwt-decode' | |
import { notify } from 'react-notify-toast' | |
import OAuth from './OAuth' | |
import Loading from './Loading' | |
import Header from './Header' | |
import Footer from './Footer' | |
import api from './api' | |
import { API_URL } from './config' |
This file contains 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
require('dotenv').config() | |
const express = require('express') | |
const path = require('path') | |
const fs = require('fs') | |
const https = require('https') | |
const http = require('http') | |
const passport = require('passport') | |
const session = require('express-session') | |
const cors = require('cors') | |
const socketio = require('socket.io') |
NewerOlder