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 / functions.js
Created September 15, 2020 18:53
Examples from Week 2 Function Practice Exercises
// Function to create a JavaScript library name generator:
// generateName("dog") should return "dog.js"
function generateName(name) {
return name.endsWith('.') ? name + "js" : name + ".js";
}
let name = "cool"
let library = generateName(name);
console.log(name, library, generateName('cool.'));
@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.js
Last active July 31, 2020 16:38
Encoding, Hashing, Salting, Encryption
/**
* Encoding
*/
const text = 'This is a sentence.';
const buf = Buffer.from(text);
console.log({
text,
base64: buf.toString('base64'),
hex: buf.toString('hex'),
url: encodeURIComponent(text)
@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: 'first.last@email.com',
};
@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 / 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 / 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
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 / 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
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>