Skip to content

Instantly share code, notes, and snippets.

View JacobKnaack's full-sized avatar

Jacob Knaack JacobKnaack

View GitHub Profile
@JacobKnaack
JacobKnaack / App.js
Last active April 16, 2019 23:47
Apollo-blog root App component
import React, { Component } from 'react'
import ApolloClient from 'apollo-boost'
import { ApolloProvider } from 'react-apollo'
import { BrowserRouter, Route } from 'react-router-dom'
import './App.css'
import 'semantic-ui-css/semantic.min.css'
import Home from './views/home'
import Article from './views/article'
@JacobKnaack
JacobKnaack / gatsby-node.js
Last active February 15, 2019 17:21
Final gatsby-node
require("dotenv").config();
const path = require('path');
/**
* Implement Gatsby's Node APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/node-apis/
*/
exports.onCreatePage = ({ page, actions }) => {
const { createPage, deletePage } = actions
@JacobKnaack
JacobKnaack / docPage.js
Last active February 8, 2019 19:45
docPage for gatsby-docs
import React from 'react'
import showdown from 'showdown'
import PropTypes from 'prop-types'
import Layout from '../components/layout.js'
import SEO from '../components/seo.js'
import { graphql, Link } from 'gatsby'
import hljs from 'highlight.js'
import 'highlight.js/styles/github.css'
const converter = new showdown.Converter({ ghCompatibleHeaderId: true })
@JacobKnaack
JacobKnaack / index.js
Last active February 8, 2019 19:29
docs - initial setup before createDoc
import React from 'react'import React from 'react'
import PropTypes from 'prop-types'
import { Link } from 'gatsby'
// formats our slugs to be used in links to our display page
function formatSlug(title) {
return title
.toLowerCase()
.replace(/[^a-zA-Z ]/g, "")
.replace(/\s/g, '-')
@JacobKnaack
JacobKnaack / createDoc.js
Last active January 27, 2019 07:09
Form for creating a doc object on Cosmic JS
import React from 'react'
import PropTypes from 'prop-types'
import Cosmic from 'cosmicjs'
import showdown from 'showdown'
const api = Cosmic()
const converter = new showdown.Converter({ ghCompatibleHeaderId: true })
const initialState = {
open: false,
@JacobKnaack
JacobKnaack / index.js
Created January 24, 2019 19:30
Home page for gastby-docs
import React from 'react'
import PropTypes from 'prop-types'
import { graphql } from 'gatsby'
import Layout from '../components/layout'
import SEO from '../components/seo'
import Docs from '../components/docs'
const IndexPage = ({ data, pageContext }) => {
return (
@JacobKnaack
JacobKnaack / gatsby-node.js
Created January 24, 2019 18:51
initial gatsby node without createPages
require("dotenv").config();
/**
* Implement Gatsby's Node APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/node-apis/
*/
exports.onCreatePage = ({ page, actions }) => {
const { createPage, deletePage } = actions
@JacobKnaack
JacobKnaack / gatsby-config.js
Created January 24, 2019 18:29
Gatsby config file for gatsby-docs
module.exports = {
siteMetadata: {
title: `Gatsby Docs`,
description: `Create and View Minimalistic Documentation, powered by GatsbyJs and CosmicJS`,
author: `@jacobknaack`,
},
plugins: [
`gatsby-plugin-eslint`,
`gatsby-plugin-react-helmet`,
`gatsby-transformer-sharp`,
@JacobKnaack
JacobKnaack / migration.py
Last active December 16, 2018 01:38
Movie Blog DB Migrations Script
import json
import requests
import base64
import markdown
BASE_URL = 'api-url-goes-here'
USER_INFO = [{"username": "Jacob", "password": "password-goes-here", "email": "email-goes-here"}, {"username": "e-vaughn",
"password": "passwor-goes-here", "email": "email-goes-here"}, {"username": "Megan", "password": "password-goes-here", "email": "email-goes-here"}]
NIT_PICKERS = []
# Check if proper users exist
import json
import requests
import base64
import markdown
import sys
if not sys.argv[1]:
raise Exception(
'NO USER SPECIFIED, please provide a user as second argument')
elif not sys.argv[2]: