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_exists_other_folder.ps1
Last active September 27, 2018 20:00
This Windows PowerShell script takes an inventory of one folder and for each file that exists will execute a delete in another folder. I wrote this to deal with some bizarre node/gulp race conditions while doing image optimization. So if a file has been processed (compressed) it is ok to delete it from the images_in folder.
# 20160601 Scott C. Krause
# Remove files that exist within out from the in folder
# This Windows PowerShell script takes an inventory of one folder and for each file that exists will execute a delete in another folder.
# I wrote this to deal with some bizarre node/gulp race conditions while doing image optimization.
# So if a file has been processed (compressed) it is ok to delete it from the images_in folder.
$dest = "\\compressed"
$source = "\\images_product\images_in"
$in = Get-ChildItem $source
@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 / 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");
@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 / 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
@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 / 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>