Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Helping others get started

David Humphrey humphd

💭
Helping others get started
View GitHub Profile
@humphd
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
humphd / urls.txt
Created Sep 15, 2020
Planet Feed URLs
View urls.txt
https://wiki.cdot.senecacollege.ca/w/api.php?action=rsd
http://zenit.senecac.on.ca/~chris.tyler/planet/
http://www.wordpress.com
http://s9y.org
http://en.wikipedia.org/wiki/RSS_(file_format)
http://en.wikipedia.org/wiki/RSS_(file_format)
http://en.wikipedia.org/wiki/Hackergotchi
http://s-aleinikov.blog.ca/feed/atom/posts/
http://ejtorre.blog.ca/feed/rss2/posts/
http://rickeyre.ca/open-source-feed.xml
@humphd
humphd / index.html
Created Oct 9, 2020
Experiments with HTML Elements
View index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Experiments with HTML Elements</title>
</head>
<body>
<h1>Main Title of Document</h1>
<h2>Embed</h2>
@humphd
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
humphd / elastic.js
Created Feb 2, 2022
Elastic mock brainstorm
View elastic.js
const { Elastic } = require(...)
const { mock } = Elastic();
beforeEach(() => mock.clearAll())
test('..', async () => {
mock.add('.....');
await request.get('/serach?...')
@humphd
humphd / LICENSE.md
Last active Oct 2, 2021
Archive of Twitter discusion on MIT License birthdate
View LICENSE.md

Introduciton

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.

Replies

@humphd
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
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
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
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();
}