Skip to content

Instantly share code, notes, and snippets.

Jacob Knaack JacobKnaack

Block or report user

Report or block JacobKnaack

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
@JacobKnaack
JacobKnaack / index.html
Last active Feb 3, 2020
Class 01 index file
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Class 01 Demo!!</title>
<style>
ul {
color: red;
}
</style>
</head>
@JacobKnaack
JacobKnaack / chart.js
Created Jan 30, 2020
Flask Analysis: Grabbing our svg
View chart.js
// Selects our parent element in our html and appens a new <svg> element
const svg = d3.select("#china-map").append("svg")
.attr("width", width)
.attr("height", height)
.append("g")
.attr("transform", "translate(0,0)");
@JacobKnaack
JacobKnaack / index.html
Last active Jan 30, 2020
Flask Analysis: index html file
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="chart.css">
<script src="https://d3js.org/d3.v3.min.js"></script>
<title>Coronavirus Data</title>
</head>
@JacobKnaack
JacobKnaack / app.py
Created Jan 29, 2020
Flask Analytics: entry file for flask application logic
View app.py
from flask import Flask, render_template, request
from util import data_parse
import json
import requests
app = Flask(__name__)
@app.route('/')
def index():
r = requests.get('https://spreadsheets.google.com/feeds/list/1AZDWMcMYXOdjigQ9YyKbzu23UlPtTAjzU2SA--b4_Kw/od6/public/values?alt=json')
@JacobKnaack
JacobKnaack / bulk-request.js
Last active Jul 29, 2019
Node Module for performing a large number of http requests in a sensible manner.
View bulk-request.js
'use strict';
/**
* Executes a large number of requests using asynchronous operations
* @param {Array} reqArray - Contains request objects formatted as per the specifications of whatever request function you are using
* @param {Function} httpPromise - A function that makes a 1 http request such as npm@request-promise: https://www.npmjs.com/package/request-promise#get-something-from-a-json-rest-api
*/
module.exports = (reqArray, httpPromise) => {
const promiseArray = reqArray.map(req => new Promise(async (resolve, reject) => {
try {
@JacobKnaack
JacobKnaack / article.js
Created Apr 17, 2019
apollo-blog Article display component
View article.js
import React from 'react'
import { Link } from 'react-router-dom'
import gql from 'graphql-tag'
import { Query } from 'react-apollo'
import { Container, Loader, Label, Image } from 'semantic-ui-react'
import './_article.css'
const GET_ARTICLE_BY_SLUG = gql`
query Article($read_key: String!, $slug: String!) {
object(bucket_slug: "apollo-blog", read_key: $read_key, slug: $slug ) {
@JacobKnaack
JacobKnaack / home.js
Last active Apr 17, 2019
apollo-blog Home View
View home.js
import React from 'react'
import gql from 'graphql-tag'
import { graphql } from 'react-apollo'
import { Link } from 'react-router-dom'
// Component from Semantic UI
import { Container, Image, Card, Label, Loader } from 'semantic-ui-react'
const GET_ARTICLES = gql`
query Articles($read_key: String!) {
@JacobKnaack
JacobKnaack / .env
Created Apr 16, 2019
Apollo-blog environment configuration
View .env
REACT_APP_COSMIC_JS_READ_KEY=your_cosmic_js_read_key
@JacobKnaack
JacobKnaack / App.js
Last active Apr 16, 2019
Apollo-blog root App component
View App.js
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 / .env
Last active Apr 17, 2019
gatsby-docs env config
View .env
COSMIC_BUCKET=your-bucket-slug
COSMIC_READ_KEY=your-read-key
COSMIC_WRITE_KEY=your-write-key
You can’t perform that action at this time.