Skip to content

Instantly share code, notes, and snippets.

Avatar

Randy Burden randyburden

View GitHub Profile
@randyburden
randyburden / Add_Yourself_As_A_Sql_Server_Express_SysAdmin.txt
Created Nov 28, 2012
Add Yourself as a SQL Server Express SysAdmin
View Add_Yourself_As_A_Sql_Server_Express_SysAdmin.txt
Adding Yourself as SQL Server Express SysAdmin
----------------------------------------------
Problem:
The help desk installs SQL Server on our developer machines under their own user accounts meaning you aren't a
sysadmin on your own SQL Server Express instance which in turn means you can't create a new database.
Solution:
@randyburden
randyburden / VbaProject.OTM
Created Sep 30, 2016
Outlook VBA Scripts for Adding Categories to New Emails
View VbaProject.OTM
Public Sub ShowCategoriesDialog()
Dim Mail As Object
Set Mail = Application.ActiveInspector.CurrentItem
Mail.ShowCategoriesDialog
End Sub
Public Sub AddAwaitingFeedbackCategory()
Dim Mail As Object
Set Mail = Application.ActiveInspector.CurrentItem
Mail.Categories = "Awaiting Feedback"
@randyburden
randyburden / SentimentPicker.html
Created May 24, 2022
Sentiment Picker (Negative, Neutral, Positive) written using Bootstrap, jQuery, and toastr. It allows the user to select a sentiment or ranking. Demo: https://codepen.io/randyburden/pen/Yzerbqv
View SentimentPicker.html
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Sentiment Picker</title>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css'>
<style>
.sentiment-picker .btn {
color: #fff;
@randyburden
randyburden / BooleanJsonConverter.cs
Created Jul 4, 2013
A Json.NET JsonConverter that can handle converting the following values into boolean values: true, false, yes, no, y, n, 1, 0.
View BooleanJsonConverter.cs
using System;
using Newtonsoft.Json;
namespace JsonConverters
{
/// <summary>
/// Handles converting JSON string values into a C# boolean data type.
/// </summary>
public class BooleanJsonConverter : JsonConverter
{
@randyburden
randyburden / Calendar_MSSQL.sql
Created Mar 17, 2022
SQL Calendar table script for MS SQL Server and MySQL databases. Populates in about 2 seconds.
View Calendar_MSSQL.sql
/* Create Calendar table for MS SQL Server (Total runtime is less than 2 seconds to populate) */
-- DROP TABLE IF EXISTS Calendar
CREATE TABLE Calendar (
CalendarDate DATE NOT NULL PRIMARY KEY,
CalendarYear SMALLINT NULL,
CalendarMonth tinyint NULL,
CalendarDay tinyint NULL,
CalendarMonthName VARCHAR(9) NULL,
CalendarDayName VARCHAR(9) NULL,
CalendarDayofWeek tinyint NULL,
@randyburden
randyburden / retryHelper.js
Created Mar 10, 2022
JavaScript retry helper utility that retries a function until the function returns a truthy value or the timeout elapses.
View retryHelper.js
/*
Retry helper utility
Author: Randy Burden - 2022 - https://www.randyburden.com/
Dependencies: none
License:
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
@randyburden
randyburden / EntityFrameworkEnumerationClassPattern.cs
Created Dec 1, 2020
Entity Framework Enumeration Class Pattern
View EntityFrameworkEnumerationClassPattern.cs
public class EmailType
{
// Provides enum-like behavior while the persisted
// reference/lookup/enum table provides referential integrity
public static readonly EmailType Welcome = new EmailType
{
Id = 1,
Name = "Welcome"
};
@randyburden
randyburden / RoundRobinList.cs
Created Nov 12, 2021
C# Round Robin List that uses a simple, thread-safe, round-robin load balancing algorithm where it provides the next item in the list each time the Next method is called and starts back at the top of the list when it reaches the end of the list.
View RoundRobinList.cs
using System;
using System.Collections.Generic;
using System.Linq;
namespace Helpers
{
/// <summary>
/// Creates a round robin list that uses a simple, thread-safe, round-robin
/// load balancing algorithm where it provides the next item in the list each
/// time <see cref="Next"/> is called and starts back at the top of the list
@randyburden
randyburden / SplitLargeLogFile.ps1
Last active Nov 8, 2021
Splits a large log file using PowerShell. Tested against very large multi-terabyte log files.
View SplitLargeLogFile.ps1
# Split Large Log File
$inputFile = "C:\temp\VeryLargeLogFile.log"
$outputDirectory = "C:\temp\logFileSplit"
$outputFileName = "LogFile"
$outputFileExtension = "log"
$upperBound = 500MB
New-Item -ItemType Directory -Force -Path $outputDirectory
$fromFile = [io.file]::OpenRead($inputFile)
@randyburden
randyburden / TableToCSV.md
Last active Nov 8, 2021
Export Table to CSV File
View TableToCSV.md

How to Export a Table to CSV

If you ever find yourself needing to export a table on a webpage you are viewing but they don't have a download or export to CSV button, use the following code to export the table to a CSV file.

  1. Use a Table to CSV browser extension like the following one. If that is not possible then following the instructions below:

  2. Open the browser's Developer Tools (F12 on Windows)

  3. Run the following command in the Console tab of the Developer Tools: