Skip to content

Instantly share code, notes, and snippets.

Helping others get started

David Humphrey humphd

Helping others get started
View GitHub Profile
humphd / restaurantDB.js
Created Jan 13, 2021
WEB422 - A1 model
View restaurantDB.js
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const restaurantSchema = new Schema({
address: {
building: String,
coord: [Number],
street: String,
zipcode: String
humphd / urls.txt
Created Sep 15, 2020
Planet Feed URLs
View urls.txt
humphd / index.html
Created Oct 9, 2020
Experiments with HTML Elements
View index.html
<!doctype html>
<meta charset="utf-8">
<title>Experiments with HTML Elements</title>
<h1>Main Title of Document</h1>
humphd / chimes.ino
Created Feb 12, 2022
Chimes Arduino Sketch
View chimes.ino
#include <Adafruit_NeoPixel.h>
#include <HTTPClient.h>
#include <WiFi.h>
// Define a pixel strip of 1 pixel
Adafruit_NeoPixel pixels(1, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
// Wifi
char ssid[] = "...";
char password[] = "...";
humphd / elastic.js
Created Feb 2, 2022
Elastic mock brainstorm
View elastic.js
const { Elastic } = require(...)
const { mock } = Elastic();
beforeEach(() => mock.clearAll())
test('..', async () => {
await request.get('/serach?...')
humphd /
Last active Oct 2, 2021
Archive of Twitter discusion on MIT License birthdate


The following is an archive of a number of parallel discussions that happened on Twitter on 1 April, 2019.

The original quesion was posed by me, and signal boosted by @stshank:

When was the MIT License created? I can't find any source that gives a year.


humphd / index.js
Created Oct 2, 2020
WEB222 Week 04
View index.js
* Week 3 - A Larger Example (String, Array, RegExp):
* Write a series of functions to accomplish the following, building a larger program as you go:
* 1. Split the string into an `Array` of separate rows (i.e., an `Array` with rows separated by `\n`).
* Bonus: how could we deal with data that includes both Unix (`\n`) and Windows (`\r\n`) line endings?
* 2. Each row contains information user info: `ID`, `Name`, `Phone Number`, and `Height` info all separated by commas.
* Split each row into an `Array` with all of its different fields. You need to deal with extra and/or no
humphd / App.jsx
Created Jan 28, 2021
WEB422 Week 4 - React Events
View App.jsx
import { useState } from 'react';
import ClickCounter from './ClickCounter';
import ClickHeading from './ClickHeading';
function App() {
// State: held by the parent
const [numClicks, setNumClicks] = useState(0);
const onClickHandler = (e) => setNumClicks(numClicks + 1);
humphd / index.js
Created Nov 19, 2020
Testing code that uses node-fetch using Jest
View index.js
// Simple module that uses fetch to do a HEAD request
const fetch = require('node-fetch');
module.exports.fn = async (url) => {
try {
const response = await fetch(url, { method: "HEAD" });
return response.ok;
} catch(err) {
return false;
humphd / App.jsx
Created Nov 19, 2020
Custom hook for Page Lifecycle API
View App.jsx
// Use it like this
import usePageLifecycle from './lib/use-page-lifecycle';
App() {
const isVisible = usePageLifecycle();