Skip to content

Instantly share code, notes, and snippets.

View laere's full-sized avatar
🎯
Focusing

Zack laere

🎯
Focusing
  • Grand Rapids, MI
View GitHub Profile
@laere
laere / FetchActionCreators.js
Created March 14, 2016 18:28 — forked from l0gicgate/FetchActionCreators.js
Reusable action creators / reducers.
import axios from 'axios';
class FetchActionCreators {
constructor(endpoint, actions) {
const [REQUEST, SUCCESS, FAILURE] = actions;
this.actions = {
REQUEST,
SUCCESS,
FAILURE,
@laere
laere / Budget.js
Last active February 15, 2019 22:23
const mongoose = require('mongoose');
const { Schema } = mongoose;
const TransactionSchema = require('./Transaction');
const budgetSchema = new Schema({
title: String,
description: String,
amount: { type: Number, default: 0 },
startDate: Date,
endDate: Date,
import React from 'react';
import { addBudget } from 'actions';
import { connect } from 'react-redux';
import BudgetForm 'components/Budgets/BudgetForm';
class BudgetCreate extends React.Component {
onSubmit = formValues => {
this.props.addBudget(formValues);
}
router.post("/register", (req, res) => {
const userProps = req.body;
const { email } = userProps;
User.findOne({ email })
.then(user => {
if (user) {
return res.status(400).json({ errormessage: "User already exists." });
} else {
const avatar = gravatar.url(email, {
const Joi = require("joi");
const registerValidationSchema = Joi.object().keys({
name: Joi.string()
.min(2)
.max(30)
.required(),
email: Joi.string()
.email()
.required(),