Skip to content

Instantly share code, notes, and snippets.

View cwg999's full-sized avatar

Cody W. Geisler cwg999

View GitHub Profile
@cwg999
cwg999 / encodeURIComponent.vb
Created September 8, 2017 14:17
encodeURIComponent in VBA for Excel
Function encodeURIComponent(strText As String) As String
Static objHtmlfile As Object
If objHtmlfile Is Nothing Then
Set objHtmlfile = CreateObject("htmlfile")
' objHtmlfile.parentWindow.execScript "function encode(s) {return encodeURIComponent(s)}", "jscript"
End If
encodeURIComponent = objHtmlfile.parentWindow.encodeURIComponent(strText)
End Function
Function decodeURIComponent(strText As String) As String
@cwg999
cwg999 / getFilesProgressWorkingDate
Created August 5, 2019 18:36
Renaming PDF's Script --- Count Estimated Progress by Working Days
# $folderPath = "C:\temp\"
Write-Host "Running!"
$file_count = 32963#[System.IO.Directory]::GetFiles($folderPath, "*.pdf", 1).Count # this should remain pretty constant
$file_count_R = [System.IO.Directory]::GetFiles($folderPath, "*R_*.pdf", 1).Count
Write-Host "Total Files: ":$file_count
Write-Host "Progressed Files: ":$file_count_R
@cwg999
cwg999 / README.md
Created August 5, 2019 11:54 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@cwg999
cwg999 / tuples.cs
Created June 7, 2019 18:08
How to use some tuples with an Enum object!
for (int i = 0; i < insertDataTables.Count(); i++)
{
List<(CurrencyIsoCode currency, bool useZero)> currencies = new List<(CurrencyIsoCode, bool)>{
(CurrencyIsoCode.EUR,true),
(CurrencyIsoCode.USD,true),
(CurrencyIsoCode.CAD,true),
(CurrencyIsoCode.MXN,true),
(CurrencyIsoCode.BRL,true),
(CurrencyIsoCode.COP,true),
};
@cwg999
cwg999 / vue_basic_loading_bar.html
Created May 29, 2019 20:27
Vue basic Materialize Loading - Using Refs Example (USE PROPS/EVENTS FIRST)
Here is just one simple way of controlling a loading overlay element. In this case "app" could be a higher level component that implements "loadingbar".
The "app" component references the loading bar using `this.$refs` which is more of a global reference for app. There are various other methods by passing down "props" to the child component, emitting an "event" that the child listens to, etc.
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<html>
<head>
<title>Loading Bar</title>
@cwg999
cwg999 / D2_Delete_Command.sql
Created May 29, 2019 19:24
DB2 Delete From Where Exists With Row Number Group By and Left Join Dependencies
DELETE FROM VCINTER.ATSDATA FF
WHERE EXISTS(
SELECT 1 FROM ( SELECT * FROM (
SELECT
ROW_NUMBER() OVER(PARTITION BY UPPER(C.PKOLD)) AS RN1, UPPER(C.PKOLD) as PKOLD2,E.PKOLDCNT, D.*,C.*
FROM VCINTER.ATSDATA C
LEFT JOIN (
SELECT
COUNT(RN) as CNT,PARPKEY
FROM (SELECT ROW_NUMBER() OVER(PARTITION BY PARPKEY) as RN, A.* FROM VCINTER.ATSDETAILS A) B
@cwg999
cwg999 / getNumberOfPdfPages.ps1
Last active May 1, 2019 17:45
Get Number of PDF Pages (Greater than 1) Parallel with Throttle Limit
$ArrayList = [System.Collections.ArrayList]@()
# Note: this scripts searches for folders named "Single" recursively from the starting folder.
Get-ChildItem -Path .\ -Recurse | Where-Object {
$_ -is [System.IO.FileInfo] `
-and ($_.Directory.Name -eq 'Single')
} | ForEach-Object {
$ArrayList.add($_.FullName)
}
# Threaded task to use pdfk to get files.
@cwg999
cwg999 / vue_stackoverflow_starter.html
Created April 2, 2019 17:54
vue stackoverflow starter
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
</div>
<script>
new Vue({
el:"#app",
template:`
<div class="row">
@cwg999
cwg999 / check_pages_openwithchrome.ps1
Created February 12, 2019 21:34
If PDFs match size and page length criteria, open them in chrome. Searches two folders "Single" and "Multiple" within the starting directory.
Get-ChildItem -LiteralPath .\ -Recurse | Where-Object {
$_ -is [System.IO.FileInfo] `
-and (($_.Directory.Name -eq 'Single' `
-and $_.Length -gt (1*1024*1204)) `
-or ($_.Directory.Name -eq 'Multiple' `
-and $_.Length -gt (5*1024*1204)))
} | ForEach-Object {
$command = '"E:\Program Files (x86)\PDFtk Server\bin\pdftk.exe" "'+$_.FullName+'" dump_data | findstr NumberOfPages'
$output = iex "& $command"
$pages = $output.Substring(15,$output.length-15)
@cwg999
cwg999 / Select2.vue
Created December 28, 2018 16:00
Select2 as a vue component
<template>
<select>
<slot></slot>
</select>
</template>
<script>
export default {
name:'Select2',
props: {
'value':{