Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rsgranne's full-sized avatar

Scott Granneman rsgranne

View GitHub Profile
@rsgranne
rsgranne / grannepack-html-vscode-settings.json
Last active April 16, 2024 05:08
VSCode settings for the extensions installed via GrannePack HTML (updated 2024-02-01)
// Place your settings in this file to overwrite the default settings
{
"breadcrumbs.enabled": true,
// Color Picker
"colorHelper.formatsOrder": [
"hsl",
"hex",
"named"
],
"css.format.spaceAroundSelectorSeparator": true,
@rsgranne
rsgranne / html5.html
Last active February 15, 2024 20:41
HTML5 template for Web dev courses
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Untitled</title>
<link rel="stylesheet" href="/css/main.css">
</head>
<body>

You can find these instructions at https://chnsa.ws/25r.


Create new folders: js & includes.

Create new file in includes: footer.html.

Cut <footer> … </footer> from index.html & paste into footer.html & save it.

@rsgranne
rsgranne / breadcrumb.js
Created October 31, 2023 09:16
Automatically populates the breadcrumb on Herbert West Landscaping webiste
// To use, insert the following in `<body>`: <script src="/js/breadcrumb.js"></script>
// Function to capitalize the first letter of a string
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
// Function to replace hyphens with spaces and format words
function formatBreadcrumbItem(item) {
return item
@rsgranne
rsgranne / include.js
Created October 31, 2023 09:10
Function to include HTML content below a specified element, id, or class
// Function to include HTML content below a specified element, id, or class
function includeHTML(url, targetElement = null) {
fetch(url)
.then(response => response.text())
.then(data => {
const parser = new DOMParser();
const htmlContent = parser.parseFromString(data, 'text/html');
const includedContent = htmlContent.querySelector('body').childNodes;
if (targetElement) {
{
/*
// Place your snippets for HTML here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// ${1}, ${2} for tab stops, ${0} for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
@rsgranne
rsgranne / css-user-snippet.json
Last active August 29, 2023 18:56
CSS user snippet used with VSCode
{
/*
// Place your snippets for CSS here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
@rsgranne
rsgranne / bootstrap-5-cdn.html
Last active February 17, 2023 23:44
Bootstrap 5 CDN template for Web dev courses
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Untitled</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<link rel="stylesheet" href="/css/main.css">
@rsgranne
rsgranne / bootstrap-5-cdn.html
Last active January 19, 2023 01:39
Bootstrap 5 CDN template for Web dev courses (2023-01-18 to 5.2.3)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Untitled</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<link rel="stylesheet" href="/css/main.css">
Hi guys. Jans & I were playing around with OpenAI.
We first pasted in Bill E’s code & asked Open AI to explain what it was doing.
Here’s Bill’s code:
document.addEventListener('DOMContentLoaded', (event) => {
var headers;
headers = document.querySelectorAll('h2[slot="header"]');
headers.forEach(