Skip to content

Instantly share code, notes, and snippets.

View LazyFatArrow's full-sized avatar

Amenallah Hsoumi LazyFatArrow

View GitHub Profile
import React from 'react';
import { Link } from 'react-router-dom';
import logo from './logo.png';
import './App.css';
const AppComponent = ({authed, login, logout}) => {
const authButtons = authed ?
<a href="#" onClick={logout}>Logout</a> :
import React from 'react';
import { connect } from 'react-redux';
import { pathToJS, firebaseConnect } from 'react-redux-firebase';
import ProfileComponent from './ProfileComponent';
const ProfileContainer = ({profile}) => (
<ProfileComponent profile={profile}/>
);
import React from 'react';
import './User.css';
const ProfileComponent = ({profile}) => (
<div className="profile">
<h2>{profile.name}</h2>
<h4>you have {profile.points} points</h4>
</div>
);
import React from 'react';
import ReactDOM from 'react-dom';
import configureStore from './store';
import { Provider } from 'react-redux';
import {
BrowserRouter as Router,
Redirect,
Route
} from 'react-router-dom';
import { pathToJS } from 'react-redux-firebase';
/* old code */
.nav {
padding: 10px;
width: 100%;
text-align: center;
border-top: 1px solid grey;
border-bottom: 1px solid grey;
}
.profile {
text-align: center;
margin-top: 50px;
}
@LazyFatArrow
LazyFatArrow / index.html
Created December 23, 2017 15:35
html entry file
<!DOCTYPE html>
<html lang="en">
<head>
<title>Inventory Manager</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="app"></div>
</body>
{
// other parts of the file we wont change
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"api": "nodemon server/index.js",
"build": "node build/build.js"
},
"directories": {
"lib": "server"
@LazyFatArrow
LazyFatArrow / index.js
Created January 13, 2018 14:48
server/services/index.js
module.exports = function () {
const app = this;
}
@LazyFatArrow
LazyFatArrow / logger.js
Created January 13, 2018 14:57
server/hooks/index.js
// A hook that logs service method before, after and error
const logger = require('winston');
module.exports = function () {
return function (hook) {
let message = `${hook.type}: ${hook.path} - Method: ${hook.method}`;
if (hook.type === 'error') {
message += `: ${hook.error.message}`;
}