Skip to content

Instantly share code, notes, and snippets.

Avatar
💯
Product Designer Interactive Storyteller

Scott C. Krause neodigm

💯
Product Designer Interactive Storyteller
View GitHub Profile
@jfet97
jfet97 / DFS.js
Last active May 5, 2021
Simple Depth First Search in JavaScript
View DFS.js
function isObject(entity) {
return typeof entity === "object" && entity !== null;
}
function getAdjacentNodes(obj) {
return (
Object.entries(obj)
.filter(([, v]) => isObject(v))
)
}
View generate_csv_and_download.js
// Desc: Produce CSV with client-side JS. Contruct Blob and Download as CSV file
let nativeCSV = ( ( _d )=>{
let oCnt, jnCSV, sCSV, blCSV, elCSV; // config, json, array, blob, and element
let retObj = {
"init": ( _oCnt )=>{
oCnt = _oCnt;
if( oCnt.fileName.indexOf("####") !== -1) {
oCnt.fileName = oCnt.fileName.replace("####", Date.now() );}
jnCSV = sCSV = blCSV = elCSV = "";
return retObj;
@neodigm
neodigm / disable_inline_stylesheet_by_selector.js
Last active Jan 17, 2021
Remove unwanted inline stylesheets by selector
View disable_inline_stylesheet_by_selector.js
var doRemoveSS = ( (_d, _q)=>{
let aS = [ ... _d.styleSheets];
aS.forEach( (oS)=>{
if( !oS.href ){
let aCSSR = [ ... oS.cssRules];
aCSSR.forEach( (oR)=>{
if( typeof oR.selectorText != "undefined"){
if( oR.selectorText.indexOf( _q ) != -1){
console.log( oR.selectorText );
oS.disabled = true;
@neodigm
neodigm / isWebGL.js
Created Oct 9, 2020
Detect WebGL 2 browser support
View isWebGL.js
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
}
}
View ms_ie_11_media_query.css
@media screen and (-ms-high-contrast: active), screen and (-ms-high-contrast: none) { /*ms*/ }
@dinh
dinh / html_data_attrib_2_javascript_dataset.js
Created Jul 12, 2020 — forked from neodigm/html_data_attrib_2_javascript_dataset.js
Convert HTML data attribute name to JS dataset name in camel case
View html_data_attrib_2_javascript_dataset.js
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 / music-ad-blocker.js
Last active Apr 15, 2021
Automatically mute the Music player when Ads are playing and unmute when they are done (in Chrome).
View music-ad-blocker.js
let spotADify = ( (_d, _q, _t) => {
let eS = _d.querySelector( _q ), bS = true;
if( eS ){ // 🏖️ Play your Jams! 🎶
bS = ( eS.getAttribute("aria-label") == "Mute" );
setInterval( () => {spotADify.tick();}, _t);
return {
"tick": () => {
if((_d.title.indexOf("Adve") != -1) || (_d.title.indexOf("Spoti") != -1)){
if( bS ){ eS.click(); bS=!true; }
}else{
View airport_geo_proximity.js
"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 Jul 15, 2020
JavaScript | Remove ALL positive tabIndex on the entire page | ES5 | A11y Testing
View dom_remove_all_tabindex_gt_0.js
// 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){
View 2013_Abbott_ADD_MDM_UX_ORACLE_STORED_PRECEDURE.SQL
CREATE OR REPLACE PACKAGE BODY ADD_ORS.ADD_UE AS
--
FUNCTION show_version
RETURN cmxlb.cmx_med_str
AS
addue_version cmxlb.cmx_med_str := 'Version 1.4 (2014-03-13 16:02:00)';
BEGIN
RETURN addue_version;
END;
--