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
@neodigm
neodigm / win_remove_if_scheduled_task_not_running.ps1
Last active May 4, 2017
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.
View win_remove_if_scheduled_task_not_running.ps1
# 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
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.
View jsMQ.js
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
Flash / Flex intelligent port location and protocol tunneling
View video_fail_safe.as
/*
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 Oct 23, 2017
Puppeteer Headless Chrome Sample - Clear Cache - stress test
View stage_lsc.js
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 Oct 30, 2017
Call JQuery document ready event
@neodigm
neodigm / demo_dev_tools.html
Created Nov 15, 2017
Demo Chrome Dev Tools | Console API
View demo_dev_tools.html
<!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 Nov 16, 2017
Get product counts from categories (Left Navigation Audit) - recursive
View snippet_left_nav_audit.js
(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 Dec 15, 2017
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.
View vuejs_axios_typeahead_autocomplete.js
/*
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 Feb 13, 2018
A quick and simple way to limit the amount of time a gh-pages prototype can be viewed.
View temp_access_to_ghpages.js
(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 Jun 6, 2018
Force the footer to float to the bottom post framework hack
View force_footer.css