Skip to content

Instantly share code, notes, and snippets.

View mark05e's full-sized avatar

mark05E mark05e

View GitHub Profile
@mark05e
mark05e / jsconfig.json
Created April 6, 2022 20:49
This file tells VS Code to treat all *.js files in the workspace as part of the same project. However it will not enable intellisense between javascript in <script> blocks and regular js files. https://stackoverflow.com/questions/49184790/how-to-using-vscode-javascripts-go-to-definition-cross-files
{
"compilerOptions": {
"target": "ES6"
},
"exclude": [
"node_modules",
"**/node_modules/*"
]
}
// https://github.com/choraria/gas-url-shortener/blob/master/apps-script/Helper.gs
function removeEmptyColumns(sheetName) {
var activeSheet = ss.getSheetByName(sheetName)
var maxColumns = activeSheet.getMaxColumns();
var lastColumn = activeSheet.getLastColumn();
if (maxColumns-lastColumn != 0){
activeSheet.deleteColumns(lastColumn+1, maxColumns-lastColumn);
}
}

Clasp Notes

.clasp.json

{
	"scriptId":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
	"rootDir":"src"
}
// postman-nice-codegen.js
// Mark05E
var log = false
var version = 0.6
var prefix = 'REQUEST'
var pm_request
var insidePostman = false
// check if we are inside GAS
// source - https://github.com/WildH0g/UnitTestingApp/blob/master/UnitTestingApp.js
function inGas() {
return typeof ScriptApp !== 'undefined';
}
// get the sheet ID from a url
// source - https://stackoverflow.com/questions/16840038/easiest-way-to-get-file-id-from-url-on-google-apps-script
function getIdFromUrl(url) {
try {
// from https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/azure-app-configuration/rest-api-postman.md
// TODO: Replace the following placeholders with your access key
var credential = "<Credential>"; // Id
var secret = "<Secret>"; // Value
var isBodyEmpty = pm.request.body === null || pm.request.body === undefined || pm.request.body.isEmpty();
var headers = signRequest(
pm.request.url.getHost(),
@mark05e
mark05e / http_server.ps1
Last active July 10, 2022 20:39 — forked from nobodyguy/http_server.ps1
Powershell HTTP server in background thread (could be easily killed)
$listenerPort = "8007"
$ServerThreadCode = {
$listenerPort = $args[0]
$listener = New-Object System.Net.HttpListener
$listenerString = "http://+:$listenerPort/"
$listener.Prefixes.Add($listenerString)
$listener.Start()
while ($listener.IsListening) {
@ECHO OFF
REM https://stackoverflow.com/questions/56928545/how-to-make-a-batch-file-react-differently-based-on-the-success-percent-of-a-pin
REM Ben Personick
@(
SetLocal EnableDelayedExpansion
ECHO OFF
SET "_PingAddress=www.aol.com"
SET "_Count=0"
)