Skip to content

Instantly share code, notes, and snippets.

Avatar

Jacob Knaack JacobKnaack

View GitHub Profile
View index.html
<!DOCTYPE html>
<html>
<head>
<!-- Meta Data -->
<title>Class 01 Demo!!</title>
<!-- select elements -->
<style>
h1 {
color: red;
@JacobKnaack
JacobKnaack / react-init.sh
Created Jul 23, 2020
React Initialization Script, used for implementing a minimal bootstrap of reacr-scripts from facebook.
View react-init.sh
#!/bin/bash
if [ $1 ]
then
echo "****8 \n Creating project directory\n*****"
mkdir $1
cd $1
else
echo "***** \n No directory specified, adding project files to CWD\n*****"
fi
View index.html
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
color: white;
background-color: aqua;
}
</style>
@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!) {