View index.html
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- Meta Data --> | |
<title>Class 01 Demo!!</title> | |
<!-- select elements --> | |
<style> | |
h1 { | |
color: red; |
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> |
View index.html
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Class 01 Demo!!</title> | |
<style> | |
ul { | |
color: red; | |
} | |
</style> | |
</head> |
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)"); |
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> |
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') |
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 { |
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 ) { |
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!) { |
NewerOlder