Skip to content

Instantly share code, notes, and snippets.

John McKim johncmckim

Block or report user

Report or block johncmckim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@johncmckim
johncmckim / garden-aid-web-bff-moisture-service.js
Last active Aug 31, 2016
Garden Aid - Web BFF - Moisture Service
View garden-aid-web-bff-moisture-service.js
'use strict';
const BbPromise = require('bluebird');
const stampit = require('stampit');
const moment = require('moment');
const Logger = require('../logger');
const MoistureService = stampit().
@johncmckim
johncmckim / garden-aid-web-bff-graphql-simplified.js
Last active Sep 26, 2016
Garden Aid - Web BFF - GraphQL Lambda
View garden-aid-web-bff-graphql-simplified.js
const graphql = require('graphql');
const tablesFactory = require('./dynamodb/tables');
const MoistureService = require('./services/moisture');
const tables = tablesFactory();
const moistureService = MoistureService({ moistureTable: tables.Moisture });
const MoistureType = new graphql.GraphQLObjectType({
name: 'MoistureType',
@johncmckim
johncmckim / garden-aid-web-bff-tables.js
Last active Aug 30, 2016
Garden Aid - Web BFF - DynamoDB Tables
View garden-aid-web-bff-tables.js
const vogels = require('vogels-promisified');
const Joi = require('joi');
module.exports = () => {
const moistureTableName = process.env.moistureTableName;
if(!moistureTableName) {
throw new Error("Missing moisture table name");
}
@johncmckim
johncmckim / garden-aid-web-bff-serverless.yml
Last active Aug 30, 2016
Garden Aid - Web BFF - Serverless config
View garden-aid-web-bff-serverless.yml
service: garden-aid-web-bff
provider:
name: aws
runtime: nodejs4.3
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:Scan
@johncmckim
johncmckim / garden-aid-react-moisture-container.js
Last active Aug 30, 2016
Garden Aid - React - Moisture container
View garden-aid-react-moisture-container.js
import gql from 'graphql-tag';
import { connect } from 'react-apollo';
import MoistureChart from '../../pres/Moisture/Chart';
export default connect({
mapQueriesToProps({ ownProps, state }) { // eslint-disable-line no-unused-vars
return {
moisture: {
query: gql`{
moisture(hours: ${ownProps.hours}, clientId: "${ownProps.clientId}") {
@johncmckim
johncmckim / garden-aid-react-store.js
Last active Aug 31, 2016
Garden Aid - React - Create store
View garden-aid-react-store.js
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
import { routerMiddleware, routerReducer } from 'react-router-redux';
import reduxThunk from 'redux-thunk';
import createLogger from 'redux-logger';
import reducerFactory from '../reducers';
export default function createAppStore(browserHistory, client, initialState = {}) {
const middlewares = [
@johncmckim
johncmckim / garden-aid-react-index.js
Created Aug 28, 2016
Garden Aid - React - Entry Point
View garden-aid-react-index.js
import { GRAPHQL_URL } from 'constants';
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, browserHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import withScroll from 'scroll-behavior';
import ApolloClient, { createNetworkInterface } from 'apollo-client';
@johncmckim
johncmckim / deploy.sh
Last active Jun 18, 2016
Serverless v0.5 Deploy
View deploy.sh
#!/bin/bash
if [[ $TRAVIS_TEST_RESULT == 1 ]]; then
echo 'Skipping deploy due to broken build';
exit 1;
fi
echo 'Starting deploy'
if [[ $TRAVIS_PULL_REQUEST == "false" ]]; then
You can’t perform that action at this time.