Skip to content

Instantly share code, notes, and snippets.

View neodigm's full-sized avatar
💯
Product Designer ⚡ Interactive Storyteller

Scott C. Krause neodigm

💯
Product Designer ⚡ Interactive Storyteller
View GitHub Profile
@neodigm
neodigm / faq_rich_snippet.js
Last active March 11, 2023 00:20
Generate JSON-LD FAQ derived from existing HTML
// This snippet when executed in the browser will log a valid JSON-LD FAQ rich snippet
// derived from the existing HTML FAQ.
// www.theScottKrause.com
const jOut = {"@context": "https://schema.org", "@type": "FAQPage","mainEntity": []}
const aelQs = [ ... document.querySelectorAll(".l-faq") ]
aelQs.forEach(function( elFAQ ){
let elQ = elFAQ.querySelector("summary")
let elA = elFAQ.querySelector("p")
let oOut = {"@type": "Question", "name": "##Q##", "acceptedAnswer": {"@type": "Answer", "text": "##A##" }}
// Clear the Cache
caches.keys().then((keyList) =>
Promise.all(
keyList.map((key) => {
return caches.delete(key);
})
)
)
@neodigm
neodigm / detect_android_soft_kb_mq.css
Created September 4, 2022 16:48
Android browsers soft kb do not overlay the page but instead push up and distort the aspect ratio.
/*
use
(min-aspect-ratio: 13/9)
(max-aspect-ratio: 13/9)
instead of
(orientation : landscape)
(orientation : portrait)
@neodigm
neodigm / is_unique.js
Created August 8, 2022 19:36
Contains all unique chars
function testUniqueChars(text) {
// www.theScottKrause.com
const aDucks = Array.from(new Set(Array.from(text)));
return text.length == aDucks.length;
}
document.addEventListener("keyup", function( ev ){
let elKey = null
let sKeyVal = ev.key.toLowerCase()
if( sKeyVal ){
if( sKeyVal == "backspace" ) sKeyVal = "bs"
if( sKeyVal == "enter" ) sKeyVal = "cr"
elKey = WrdKey.getKeyEl( sKeyVal )
if( elKey ){ // Simulate Tap
const evMD = new MouseEvent('mousedown', {view: window, bubbles: true, cancelable: true })
const evMU = new MouseEvent('mouseup', {view: window, bubbles: true, cancelable: true })
@neodigm
neodigm / brands.sql
Created February 9, 2022 17:43
Create Table DDL | SEMB whitelable reports tech design db api
-- phpMyAdmin SQL Dump
-- version 4.9.7
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Feb 09, 2022 at 11:40 AM
-- Server version: 10.3.29-MariaDB
-- PHP Version: 7.4.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
var simuClick = function (elem) {
var evt = new MouseEvent("click", {
bubbles: true,
cancelable: true,
view: window
});
var canceled = !elem.dispatchEvent(evt);
};
var limitGraphics = (function( _d, _q ){
var aImgs = _d.querySelectorAll( _q );
if( aImgs.length >= 75 ) window.stop();
})(document, "[src*=graphics-prod");
let aTiny = {"a":"ᵃ","b":"ᵇ","c":"ᶜ","d":"ᵈ","e":"ᵉ","f":"ᶠ","g":"ᵍ","h":"ʰ","i":"ᶦ","j":"ʲ","k":"ᵏ","l":"ᶫ","m":"ᵐ","n":"ᶰ","o":"ᵒ","p":"ᵖ","q":"ᑫ","r":"ʳ","s":"ˢ","t":"ᵗ","u":"ᵘ","v":"ᵛ","w":"ʷ","x":"ˣ","y":"ʸ","z":"ᶻ","A":"ᴬ","B":"ᴮ","C":"ᶜ","D":"ᴰ","E":"ᴱ","F":"ᶠ","G":"ᴳ","H":"ᴴ","I":"ᴵ","J":"ᴶ","K":"ᴷ","L":"ᴸ","M":"ᴹ","N":"ᴺ","O":"ᴼ","P":"ᴾ","Q":"ᑫ","R":"ᴿ","S":"ˢ","T":"ᵀ","U":"ᵁ","V":"ⱽ","W":"ᵂ","X":"ˣ","Y":"ʸ","Z":"ᶻ","`":"`","~":"~","!":"﹗","@":"@","#":"#","$":"﹩","%":"﹪","^":"^","&":"﹠","*":"﹡","(":"⁽",")":"⁾","_":"⁻","-":"⁻","=":"⁼","+":"+","{":"{","[":"[","}":"}","]":"]",":":"﹕",";":"﹔","?":"﹖"};
let doTinyCaption = ( (_d, _q, _t) => { // Inject Tiny type
let aTinyCnt = [..._d.querySelectorAll( _q )];
if( aTinyCnt ){ setTimeout( ()=>{ doTinyCaption.tick(); }, 32); }
return {
"tick": ()=>{
let sMU = "";
aTinyCnt.forEach( (eVivCnt) => {
if(eVivCnt.atTiny !== eVivCnt.dataset.atTiny){ // Data atr changed
@neodigm
neodigm / vuejs_provide_inject_reactive.js
Last active September 6, 2021 16:03
Vuejs Provide Inject Reactive Component Communication
//. Parent Component
provide() {
return {
cyRef: this.cytoRef,
obsId: this.obsId,
hostname: () => this.reactiveHostname
}
}
//. Child Component