Skip to content

Instantly share code, notes, and snippets.

View humphd's full-sized avatar
💭
Helping others get started

David Humphrey humphd

💭
Helping others get started
View GitHub Profile
@humphd
humphd / Code-From-Class-Updated.js
Last active October 1, 2019 00:52
Sample Email Parser
// NOTE: updated to fix some bugs on Mon Sept 30, 2019
/**
* Constructor function for an Email object.
*
* @param {String} rawEmail - text of a raw email, with headers and body
*/
function Email(rawEmail) {
// Step 1: split the raw email text into its two main parts: header and body.
// The split occurs at the first empty line (i.e., \n\n)
@humphd
humphd / backgroundfile-51599.txt
Last active October 11, 2019 18:46
WEB222 - HTML Practice
Response To Council Request For Information On Red Light Camera Infractions
STAFF REPORT ACTION REQUIRED with Confidential Attachment
Response To Council Request For Information On Red Light Camera Infractions
Date: October 30, 2012
To: Government Management Committee
From: Director of Court Services and City Solicitor
Wards: All
@humphd
humphd / users.json
Created January 27, 2020 12:40
Fake Users Data
[{"id":"30-037-5927","username":"cgotecliffe0","firstName":"Collin","lastName":"Gotecliffe","email":"[email protected]","score":4033},
{"id":"75-536-1230","username":"cpeppett1","firstName":"Clerc","lastName":"Peppett","email":"[email protected]","score":4686},
{"id":"92-051-5244","username":"nbaudts2","firstName":"Nadiya","lastName":"Baudts","email":"[email protected]","score":3262},
{"id":"34-016-9293","username":"bmoseby3","firstName":"Bunni","lastName":"Moseby","email":"[email protected]","score":438},
{"id":"24-231-6207","username":"nconkey4","firstName":"Nan","lastName":"Conkey","email":"[email protected]","score":2146},
{"id":"74-441-7599","username":"bsnelman5","firstName":"Betsy","lastName":"Snelman","email":"[email protected]","score":643},
{"id":"46-589-1373","username":"pligerton6","firstName":"Patton","lastName":"Ligerton","email":"[email protected]","score":2083},
{"id":"62-512-5616","username":"mbridewell7","firstName":"Madlen","lastName":"Bridewell","email":"mbridewe
@humphd
humphd / index.html
Created February 13, 2020 20:09
HTML Examples from WEB222 Feb 12, 2020
<!-- Table Example -->
<table>
<tbody>
<tr>
<td colspan="3">1</td>
</tr>
<tr>
<td>2</td>
<td>3</td>
@humphd
humphd / script.js
Created March 4, 2020 20:15
Event Example from WEB222
window.onload = function() {
let src = 'https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_1MB.mp4'
document.body.addEventListener('click', function() {
// Create a source element
let source = document.createElement('source');
// Set its src to be our video URL
source.src = src;
// Grab the video element and add the source to it
let video = document.querySelector('video');
@humphd
humphd / index.html
Last active March 14, 2020 03:19
CSS Example
<!doctype html>
<html>
<head>
<title>CSS Layout Example</title>
<meta charset="utf-8">
<!-- Deal with viewport sizing on mobile: https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Google Fonts: 1) body text - Oswald Regular; 2) headings Cardo Regular -->
@humphd
humphd / form-with-bootstrap.html
Created March 29, 2020 18:19
Forms, CSS, and Bootstrap Examples
<!DOCTYPE html>
<html>
<head>
<title>Form with CSS</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
</head>
<body>
<div class="container">
@humphd
humphd / index.html
Created April 5, 2020 22:22
Form Validation Files
<!DOCTYPE html>
<html>
<head>
<title>Form Validation</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Load Bootstrap's CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
</head>
<body>
@humphd
humphd / hounds.js
Last active July 2, 2020 20:42
WEB222 Summer 2020 - Week 7 Events
/**
* Image URLs of Hounds from the Dog API:
* https://dog.ceo/dog-api/documentation/breed
*/
const hounds = [
"https://images.dog.ceo/breeds/hound-afghan/n02088094_1003.jpg",
"https://images.dog.ceo/breeds/hound-afghan/n02088094_1007.jpg",
"https://images.dog.ceo/breeds/hound-afghan/n02088094_1023.jpg",
"https://images.dog.ceo/breeds/hound-afghan/n02088094_10263.jpg",
"https://images.dog.ceo/breeds/hound-afghan/n02088094_10715.jpg",
@humphd
humphd / App.js
Created July 15, 2020 18:26
Test 3, Question 2: Clarifying React state vs. props
import React from 'react';
import Email from './Email';
class App extends React.Component() {
constructor() {
super();
this.state = {
name: 'First Last',
email: '[email protected]',
};