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 / win_remove_if_scheduled_task_not_running.ps1
Last active May 4, 2017 14:08
This PowerShell script will remove files, if they are older than one hour and if the Scheduled task is NOT running, and if the Scheduled task has not updated it log in the past two minutes.
# 20160601 Scott C. Krause
# This PowerShell script will remove files, if they are older than one hour and if the Scheduled task is NOT running, and if the Scheduled task has not updated it log in the past two minutes.
Set-ExecutionPolicy Bypass
# popu var if compr proc is not busy
$recent_logged = Get-Item C:\ltd_auto_image\logs\ltd_auto_image.txt | where-object {(new-timespan $_.LastWriteTime).minutes -ge 16}
if ($recent_logged) {
# if sched task / compr proc is state running del
$ltd_auto_running = Get-ScheduledTask -TaskName ltd_auto_image | Where State -eq "Running"
#if ($recent_logged) {
@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(){
@neodigm
neodigm / video_fail_safe.as
Created May 9, 2017 19:52
Flash / Flex intelligent port location and protocol tunneling
/*
This ActionScript package will except a string of port numbers in most
likely order (from the configuration XML).
For example: 1935, 8080, 80.
It will then attempt to connect to each port in sequence
every 800 milliseconds. If port 80 is used then the
tunneling protocol is returned (rtmpt).
*/
@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 / unit_test_jquery_doc_read.js
Created October 30, 2017 15:40
Call JQuery document ready event
$.readyList[0]();
@neodigm
neodigm / demo_dev_tools.html
Created November 15, 2017 21:43
Demo Chrome Dev Tools | Console API
<!DOCTYPE html>
<head>
<title>Demo Dev Tools</title>
</head>
<body>
<h1>Demo Dev Tools</h1>
<!-- In the Chrome dev tools select the P element > break on > Attrib Modifications
-->
<p id="js-my-text__id">This is text</p>
<a id="js-click-me__id">Click Me</a>
@neodigm
neodigm / snippet_left_nav_audit.js
Created November 16, 2017 19:17
Get product counts from categories (Left Navigation Audit) - recursive
(function() {
$("#main-content .sub-cat > a").each(function(){
$Ak = $(this);
if( $Ak.attr("href") !== "#"){
var sURI = $Ak.attr("href");
var sName = $Ak.text();
try {
var sID = $.ajax( { dataType: "html", type: "GET", url: sURI, async: false } );
var nPloc = sID.responseText.indexOf( "sizeTotalNumRecs" );
if( nPloc >= 1){
@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 / temp_access_to_ghpages.js
Last active February 13, 2018 15:27
A quick and simple way to limit the amount of time a gh-pages prototype can be viewed.
(function( doc, dNow ){
var bOk = false;
var urlParams = new URLSearchParams( window.location.search );
if( urlParams.has( "token" ) ){
var sToken = urlParams.get( "token" );
var nDiff = ( dNow.getTime() - Number( sToken ) ) / 1000;
if( nDiff >= 3000 || isNaN( nDiff ) ){
bOk = false;
}else{
bOk = true;
@neodigm
neodigm / force_footer.css
Created June 6, 2018 19:58
Force the footer to float to the bottom post framework hack