Skip to content

Instantly share code, notes, and snippets.

View thedannywahl's full-sized avatar

Danny Wahl thedannywahl

View GitHub Profile
@thedannywahl
thedannywahl / add_deno_task_deploy.sh
Last active January 25, 2024 19:52
Add task to Deploy Deno Fresh with Tailwind
#!/bin/bash
# one-liner:
# curl -fsSL https://gist.github.com/thedannywahl/7c0de1a4c9c424b96e1db13252e596db/raw/867e728066f5855141ca8e796a1ecffa70f7031d/add_deno_task_deploy.sh | sh
# This script adds a deploy task to a Deno Fresh project.
# It requires Deno Fresh 1.6+ with Tainwind enabled.
# It builds the project (required for Tailwind CSS) and then commits and pushes with
# deno task deploy
if [ ! -f fresh.config.ts ] || [ -f tailwind.config.ts ] || [ ! -d .git ]; then
echo "This script must be run from the root of a Deno Fresh 1.6+ project with Tailwind enabled.";
exit 1;
@thedannywahl
thedannywahl / insertGoogleAnalytics.js
Last active September 26, 2023 19:38
Insert Google Analytics v4 in the Canvas Theme Editor
// Replace with your Measurement ID
const mID = `G-0123456789`
const b = document.getElementsByTagName(`body`)[0]
const g = document.createElement(`script`)
g.src = `https://www.googletagmanager.com/gtag/js?id=${mID}`
g.async = true
const i = document.createElement(`script`)
i.textContent =
`window.dataLayer = window.dataLayer||[];
function gtag() {dataLayer.push(arguments);}
@thedannywahl
thedannywahl / Display HyperLinks.bas
Last active August 29, 2023 18:58
Display Hyperlinks Macro
@thedannywahl
thedannywahl / documentObserver.js
Last active June 1, 2023 15:22
document observer
const doc = document.documentElement
const mCallback = (mutations) => {
for (let mutation of mutations) {
const added = mutation.addedNodes.length
console.log(`Content has been ${ (added) ? `added: ${mutation.addedNodes[0].localName}` : `removed: ${mutation.removedNodes[0].localName}` }`)
}
}
const observer = new MutationObserver(mCallback)
@thedannywahl
thedannywahl / README.md
Last active March 30, 2023 01:11
A loader file to remotely load github gists (js & css files) in webpages.

gh-loader

gh-loader is a simple drop-in javascript which can in turn load js and css files from gist(s) & github repos

  • supports multiple gists & files (just add gist id or repo file path to gh array)
  • supports multi-file gists (automatically loads all .js and .css files from a gist)
  • support for remote loading (via githack.com) of content when content is truncated or from a repo
  • creates a console group for each gist file or repo file to capture any console.* statements
  • provides data attributes for embedded HTML
  • Supports debugging with debug flag
@thedannywahl
thedannywahl / README.md
Last active March 25, 2023 18:02
sample files for gist-loader.js for Canvas LMS

This gist contains sample functions and styles for Canvas LMS which can be loaded with gist-loader

@thedannywahl
thedannywahl / Link.js
Last active March 24, 2023 22:07
Default examples for gh-loader
@thedannywahl
thedannywahl / canvas-show-course-progress-on-dashboard.js
Last active March 23, 2023 19:40
Display course progress information on the course card.
/*
* canvas-show-course-progress-on-dashboard.js
* by: Spencer Lawson slawson@instructure.com
* by: Danny Wahl danny@instructure.com
* Adds a current progress and expected progress
* bar to the course tile. Current progress is
* based on the module requirements and expectedProgress
* progress is as a percentage of total course time.
*/
@thedannywahl
thedannywahl / locate.sh
Created February 7, 2022 15:20
Find matching files in a folder with different extensions
#!/bin/bash
pd="$(basename "$PWD")";
tmp="/nfs/Multimedia/Temp/Pictures/"
ext1=".JPG"
ext2=".jpg"
mkdir -p "$tmp$pd";
for d in */; do
cd "$d";
wd="$(basename "$PWD")";
for f in *"$ext1"; do
@thedannywahl
thedannywahl / DisplayHyperlinks.vba
Created January 27, 2022 19:10
VBA Display Hyperlink URLs in Word