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 / font_awesome_to_svg.md
Last active July 12, 2020 07:51
How to convert a single Font Awesome character to SVG so that it can be used in the browser without loading web fonts.

This simple procedure describes how to convert a single Font Awesome character to SVG so that it can be used in the browser without loading web fonts.

  1. Get latest of this file fontawesome-webfont.svg – It’s in their git repo, view raw
  2. Open in textpad
  3. Search for the character on the font awesome website, drill down and you will see the Unicode value.
  4. Search for that Unicode value in fontawesome-webfont.svg
  5. Copy starting from d= …. To “ but not />
  6. On a new tab paste into between the below template
"use strict";
/*
Created an airport geo-proximity microservice that could answer the questions, like; “What are the three closest airports to me right now?”.
*/
var system_output = {
"airports": {
"ASE": {
"additionalInfo": null,
"cityName": "ASPEN",
"code": "ASE",
@neodigm
neodigm / dom_remove_all_tabindex_gt_0.js
Last active July 15, 2020 16:01
JavaScript | Remove ALL positive tabIndex on the entire page | ES5 | A11y Testing
// Remove ALL tabIndex on the entire page - Thats a fun thing to do. ES5
// From the entire document remove tabIndex if its value is greater than 0
[].slice.call( document.querySelectorAll("[tabIndex]") ).filter(function(el){ // Neodigm 2020
console.log("-- | " + el.tabIndex );
if( el.tabIndex >= 1 ){
el.tabIndex = "";
}
});
// From the entire document add a tabIndex="0" attrib if an A has no href
[].slice.call( document.querySelectorAll("A") ).filter(function(el){
@neodigm
neodigm / html_data_attrib_2_javascript_dataset.js
Last active July 15, 2020 16:04
Convert HTML data attribute name to JS dataset name in camel case
function data2prop( sDset ){ // Convert HTML data attrib name to JS dataset name
sDset = sDset.replace("data-", "").toLowerCase();
let aDset = sDset.split(""), aDret = [], bUpper = false;
aDset.forEach( (sVal, nIx) => {
if( sVal == "-" ){
bUpper = true;
}else{
aDret.push( ( bUpper ) ? sVal.toUpperCase() : sVal );
bUpper = false;
}
@neodigm
neodigm / material_design_skin.js
Last active July 15, 2020 16:05
Another MD input box, but this one is declarative. Requires a separate CSS file. Works on IE11.
var oMDPage = ( function( _d ){ // Material Design INPUT Labels
var aInp = [], aLab = [], sBrand="", bBound = false, nCnt = -1;
function onInpFoc( _el ){ // focus
if( typeof _el.dataset.mdLabel !== "undefined" ){
var sPH = _el.getAttribute("placeholder");
if( sPH ){
_el.dataset.mdLabelPh = sPH;
_el.placeholder = "";
aLab[ _el.dataset.mdLabel ].classList.remove( "h-vs__hidden" );
}
@dinh
dinh / html_data_attrib_2_javascript_dataset.js
Created July 12, 2020 07:33 — forked from neodigm/html_data_attrib_2_javascript_dataset.js
Convert HTML data attribute name to JS dataset name in camel case
function data2prop( sDset ){ // Convert HTML data attrib name to JS dataset name
sDset = sDset.replace("data-", "").toLowerCase();
let aDset = sDset.split(""), aDret = [], bUpper = false;
aDset.forEach( (sVal, nIx) => {
if( sVal == "-" ){
bUpper = true;
}else{
aDret.push( ( bUpper ) ? sVal.toUpperCase() : sVal );
bUpper = false;
}
@neodigm
neodigm / page_fade.js
Created November 19, 2018 20:49
Fade a page so that it is difficult for shoulder surfers to see. On the DL.
// Run as a Chrome Snippet
document.body.style = "opacity: 0.2;filter:grayscale(100%);";
@neodigm
neodigm / isWebGL.js
Created October 9, 2020 14:41
Detect WebGL 2 browser support
var isWebGL2Available = function () { // Does this browser support WebGL 2?
try {
var canvas = document.createElement('canvas')
return !!(window.WebGL2RenderingContext && canvas.getContext('webgl2'))
} catch (e) {
return false
}
}
// Automotive Dealership stock photo gallery components (Adobe ActionScript 3.0)
import com.mosesSupposes.fuse.*;
import flash.external.*;
ZigoEngine.simpleSetup(Shortcuts, PennerEasing);
ZigoEngine.EASING = 'easeOutExpo';
ZigoEngine.DURATION = 5;
ZigoEngine.OUTPUT_LEVEL = 9;
// Desc: Asynchronous recursive crawl report the total number of products by category
// Usage: catCount.init();
var catCount = (function(_d,_q){
"use strict";
let aSub = [];
console.clear();
return {