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 / forms.html
Created November 23, 2023 20:08
Web222 Week 11
<!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 href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"> <!-- Our stylesheet -->
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.2/font/bootstrap-icons.min.css">
@humphd
humphd / doi2json.ts
Created November 2, 2023 15:15
Convert a DOI or DOI URL to JSON via CrossRef API
/**
* Gets JSON citation data from the CrossRef API for a DOI or DOI URL
* @param doi A DOI or DOI URL
*/
export async function doi2json(doiOrUrl: string) {
// Extract the DOI from the URL
const doi = doiOrUrl.replace('https://doi.org/', '');
// Fetch data from the CrossRef API
const response = await fetch(`https://api.crossref.org/works/${doi}`);
@humphd
humphd / runJS.js
Created July 24, 2023 15:36
CharCraft JS Runtime function
export const name = "runJS";
export const description = "Runs arbitrary JavaScript code in a browser context (no node.js)";
export const parameters = {
type: "object",
properties: {
"code": {
type: "string",
description: "JavaScript code to run in browser",
@humphd
humphd / sum.js
Created July 23, 2023 14:56
ChatCraft sum function
/**
* Example Function Module. Each function needs you to define 4 things:
*/
/* 1. Name of your function */
export const name = "sum";
/* 2. Description of function, used to describe what it does to an LLM */
export const description = "Adds all numbers passed to it, returning the total.";
@humphd
humphd / restaurantDB.js
Created January 13, 2021 15:18
WEB422 - A1 model
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 September 15, 2020 00:22
Planet Feed URLs
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 October 9, 2020 19:38
Experiments with HTML Elements
<!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 February 12, 2022 20:13
Chimes Arduino Sketch
#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 February 2, 2022 20:14
Elastic mock brainstorm
const { Elastic } = require(...)
const { mock } = Elastic();
beforeEach(() => mock.clearAll())
test('..', async () => {
mock.add('.....');
await request.get('/serach?...')
@humphd
humphd / LICENSE.md
Last active October 2, 2021 21:23
Archive of Twitter discusion on MIT License birthdate

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