Skip to content

Instantly share code, notes, and snippets.

View rsgranne's full-sized avatar

Scott Granneman rsgranne

View GitHub Profile

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) {
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(
@rsgranne
rsgranne / system-fonts-bs522.css
Created November 21, 2022 20:39
System font stack used by Bootstrap 5.2.2
font-family: system-ui, -apple-system,"Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
@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">
@rsgranne
rsgranne / bootstrap-5-nav-sample.html
Created October 5, 2021 12:51
Bootstrap 5 nav sample
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
@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 / 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 / bootstrap-4-npm-package.json
Created April 16, 2019 19:03
Bootstrap 4 NPM package.json template for Web dev courses
{
"name": "bootstrap-4",
"version": "1.0.0",
"description": "Bootstrap 4",
"main": "index.js",
"scripts": {},
"author": "",
"license": "ISC",
"dependencies": {
"bootstrap": "^4.3.1",