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 / jsMQ.js
Created May 9, 2017 17:59
JavaScript Media Query or jsMQ is a function that can tell you what the current state of the browser is (Small, Medium or Large) and notify you if there is a change.
jsMQcallback = $.Callbacks(), jsMQcurrent = "";
var jsMQ = {
getVW : function(){
vw=jQuery(window).width();
if(vw <= 480) return "s";
if((vw >= 480) && (vw <= 748)) return "sl";
if((vw >= 749) && (vw <= 965)) return "m";
if(vw >= 966) return "l";
},
pubVW : function(){
@kogakure
kogakure / gist:6595093
Created September 17, 2013 14:30
HTML/CSS: Intrinsic Ratios image solution for responsive images
<div class="img-container">
<img src="http://cdn3.spiegel.de/images/image-545702-breitwandaufmacher-penw.jpg">
</div>
@neodigm
neodigm / stage_lsc.js
Created October 23, 2017 21:30
Puppeteer Headless Chrome Sample - Clear Cache - stress test
const puppeteer = require('puppeteer');
(async () => {
for( var i = 1; i < 501; i++){
var browser = await puppeteer.launch({headless: true, slowMo: 1000});
var page = await browser.newPage();
page.setViewport({width: 980, height: 3200});
await page.goto('https://qqqqqqqqqqq');
await page.screenshot({path: 'ltdc_stage_lsc_'+i+'.png'});
await browser.close();
@neodigm
neodigm / vuejs_axios_typeahead_autocomplete.js
Last active December 15, 2017 03:23
This experiment replaces legacy JQuery and JQuery typeahead plug-in with Vue.js and Axios. This script is fired manually after the page is loaded via a Chrome Snippet. The resulting solution will not require JQuery but will require promises.
/*
Optim Book Axios - New Type Ahead | SCK
Lakeside prod enter 141893 then execute this snippet
*/
$("#branding").append("<link rel='stylesheet' href='https://neodigm.github.io/is-ecom-labs/autocomplete/autocomplete.css' type='text/css' media='all' />");
$("#branding").append("<script src='https://unpkg.com/axios/dist/axios.min.js'></script>");
$("#branding").append("<script src='https://unpkg.com/vue@2.4.2/dist/vue.js'></script>");
@neodigm
neodigm / simple_image_lazy_load.js
Last active September 27, 2018 19:58
JavaScript Lazy Load
"use strict";
var fLazy = (function(doc){
return { "init" : function( _bMobl ){
var _aE = [].slice.call( doc.querySelectorAll( "[data-lz-src]" ) );
_aE.filter( function( _e ){
if( _bMobl ){ // isMobile
if( _e.dataset.lzM ){ // data-lz-m
_e.src = _e.dataset.lzSrc;
}
}else{
@neodigm
neodigm / zurb_foundation_equalizer_alternative.js
Created May 2, 2017 21:38
Lightweight Zurb Foundation Equalizer alternative
// Lightweight ZF Equalizer alternative
// Will make two or more HTML elements the same height
// Usage: eq2.makeEqual("[data-equalizer-watch='your_pattern']");
var eq2 = {
Mx: 0,
makeEqual: function( data_eqlzr_watch ){
$( data_eqlzr_watch ).each(function(){
eq2.Mx = ( this.clientHeight > eq2.Mx ) ? this.clientHeight : eq2.Mx;
});
$( data_eqlzr_watch ).css("height", eq2.Mx + "px");
@samholmes
samholmes / post.md
Last active April 16, 2020 22:27
Discussion on how to write a parallel asynchronous routine using plain, vanilla JS.

Parallel Async Patterns in Vanilla JS

function routine(){
    var counter = 3;
    
    asyncThing(function(){
        // Do stuff
        
        done();

Keybase proof

I hereby claim:

  • I am neodigm on github.
  • I am neodigm (https://keybase.io/neodigm) on keybase.
  • I have a public key ASDzn1bBMQ39o2wKC4ZvecfI8YsYBf2lxq2j0JBlXrprawo

To claim this, I am signing this object:

@neodigm
neodigm / multiClick.js
Created November 12, 2019 19:01
mutiClick Super Simple Vanilla JavaScript ES5 Clicker IIFE
var multiClick = (function( _d ){ // Click lots of stuff
return {
"all": function( sQuery ){
if( sQuery ){
[].slice.call( _d.querySelectorAll( sQuery ) )
.filter(function( eL ){ eL.click() })
}
}
}
@neodigm
neodigm / extract_long_tail_keywords_google_ai.js
Last active July 12, 2020 07:47
Persist Long Tail Keywords from the Google Drop-down
// Persist Long Tail Key Words from Google SERP
var fLong = (function(){
var _aPKW = localStorage.getItem( "gogl_ai_keywords" );
if( _aPKW ){
_aPKW = JSON.parse( _aPKW );
}else{
_aPKW = [];
}
return {
doit : function(){