Skip to content

Instantly share code, notes, and snippets.

var DocumentAppUtility = (function (dau, da) {
dau.Tables = (function(dautables, da) {
function findTableByHeaders(tables, headersMatch) {
for (var i=0; i<tables.length; i++) {
var table = tables[i],
headerRow = table.getRow(0),
numCells = headerRow.getNumCells(),
columnLookup = {},
headerNames = [];
function CaseInsensitiveLookup() {
this.obj = {};
this.keys = {};
this.getKey = function(key) {
if (key) {
var lKey = key.toLowerCase(),
lastKey = this.keys[lKey];
return this.keys[lKey] = (lastKey || key);
@leachdaniel
leachdaniel / DocumentAppUtility.Tables.replaceContents.gs
Last active November 3, 2017 03:30
DocumentAppUtility.Tables.replaceContents.gs
var DocumentAppUtility = (function (dau, da) {
dau.Tables = (function(dautables, da) {
function replaceContents(table, data, deleteExtra, startRow) {
var numRows = table.getNumRows(),
startRow = (startRow || 0),
rowNum = null,
row = null,
cell = null;
@leachdaniel
leachdaniel / UpdateAssemblyInfo.ps1
Last active November 7, 2017 21:37
Update Assembly Info
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$buildNumberString,
[Parameter(Mandatory = $false)]
[string]$informationalVersionString
)
$ErrorActionPreference = 'Stop';
@leachdaniel
leachdaniel / WinToggleOrRun.ahk
Last active November 25, 2017 18:38
Toggle Or Run Windows in AHK
; This function is a lot like WinActivate, but allows you to pass a path to run if the window is not found
; It also uses WinActivateBottom if the matching window is already active, allowing you to toggle through windows
; Be careful with the winmatch, the case sensitivity includes ahk_class and ahk_exe because we are using RegEx match mode
; Tested with AHK Version 1.1.26.00
WinToggleOrRun(winmatch, pathOrCommand, excludeTitleRegex:=0)
{
; Every newly launched thread (such as a hotkey, custom menu item, or timed subroutine) starts off fresh with the default setting for this command.
SetTitleMatchMode, RegEx
IfWinExist, %winmatch%, , %excludeTitleRegex%
@leachdaniel
leachdaniel / WebServicesBrowseWithReadme.md
Last active June 27, 2018 15:16
Visual Studio Browse With for Web Services Settings Using Powershell

Update - this no longer works with recent updates to Visual Studio

Visual Studio Browse With for Web Services Settings Using Powershell

Background

By default, Visual Studio 2017 and most prior versions open up a web browser session every time you start a web api or mvc application. This can be annoying if you are trying to debug a web service API. The following steps add "Browser" that's just a powershell api call to initialize the web service.

Steps

@leachdaniel
leachdaniel / ExtendedDataRecord.cs
Created December 15, 2017 04:58
IDataReader Wrapper that adds some functionality
internal class ExtendedDataRecord : IDataRecord
{
public ExtendedDataRecord(IDataReader reader)
{
_reader = reader;
}
public int IndexOf(string name)
{
if (_fieldNames == null)
{
@leachdaniel
leachdaniel / jsrounding.js
Created December 30, 2017 21:22
JavaScript Rounding
if ((14.28*9 != 128.52) || (66.66*5 != 333.3) || (21.17*6 != 127.02)) {
document.write("<b>Rounding Errors Detected:</b><BR><BR>");}
else {document.write("<b>No Rounding Errors Detected:</b><BR><BR>"); }
document.write("14.28 x 9 should be <b>128.52</b>;<br><small>your browser's answer = </small><b>" + (14.28*9)+"</b><br><br>");
document.write("66.66 x 5 should be <b>333.3</b>;<br><small>your browser's answer = </small><b>" + (66.66 * 5)+"</b><br><br>");
document.write("21.17 x 6 should be <b>127.02</b>;<br><small>your browser's answer = </small><b>" + (21.17*6)+"</b><br><br>");
@leachdaniel
leachdaniel / Program_DNSServer.cs
Created January 14, 2018 15:15
.Net DNS Server Example
//<PackageReference Include="DNS" Version="2.1.0" />
namespace DNSServer
{
class Program
{
static void Main(string[] args)
{
DNS.Server.DnsServer server = new DNS.Server.DnsServer("8.8.8.8");
server.Requested += Server_Requested;
@leachdaniel
leachdaniel / Program_DynamicallyCallMethodOnAssembly.cs
Created January 14, 2018 16:07
Dynamically Load an Assembly and call a method on it
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace InterfaceCaller
{
class Program