Skip to content

Instantly share code, notes, and snippets.

View GordonBeeming's full-sized avatar
💭
delivering value

Gordon Beeming [SSW • Microsoft MVP] GordonBeeming

💭
delivering value
View GitHub Profile
@GordonBeeming
GordonBeeming / SqlUtil.cs
Last active January 6, 2023 00:27
Standalone SQL Utility based off the one that is part of BinaryDigit.dll - https://github.com/Gordon-Beeming/BinaryDigit/blob/master/BinaryDigit/DataAccess/Sql.cs
/***************************************************************************\
Module Name: SqlUtil.cs
Project: GitHub Gist
Url: http://go.beeming.net/28WaNE0
A sample class to interact with Microsoft SQL Server for all the basic data access layer operations.
The MIT License (MIT)
Copyright (c) Gordon Beeming
@GordonBeeming
GordonBeeming / SqlUtilAsync.cs
Last active January 6, 2023 00:27
Standalone SQL Async Utility based off the one that is part of BinaryDigit.dll - https://github.com/Gordon-Beeming/BinaryDigit/blob/master/BinaryDigit/DataAccess/Sql.cs. Although this one has all it's methods converted to use the Task Async methods to access the database
namespace MyApp.DataAccess
{
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Threading.Tasks;
public static class SqlUtilAsync
{
@GordonBeeming
GordonBeeming / Run PS File with My name.bat
Last active August 29, 2015 14:15
Simple batch file that runs a ps1 file that matches the bat file name with unrestricted execution policy
@ECHO OFF
cd /d %~dp0
powershell.exe -ExecutionPolicy Unrestricted -File ".\%~n0.ps1"
pause
@GordonBeeming
GordonBeeming / SqlUtilAsync-v6.cs
Created February 26, 2015 15:23
Standalone SQL Async Utility based off the other on hosted on https://gist.github.com/Gordon-Beeming/03e5f349ca9b2776b317. This one just makes use of some C# 6 features.
namespace MyApp.DataAccess
{
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Threading.Tasks;
public static class SqlUtilAsync
{
@GordonBeeming
GordonBeeming / HashHelper.cs
Last active March 28, 2024 14:49
Hash Helper class with methods for creating hashes for MD5, SHA1, SHA256, SHA384, SHA512 and RIPEMD160.
using System;
using System.IO;
using System.Security.Cryptography;
/// <summary>
/// https://gist.github.com/Gordon-Beeming/281e019d0b61bf045bd5
/// </summary>
public static class HashHelper
{
public enum Algorithms
@GordonBeeming
GordonBeeming / AsyncHelpers.cs
Created January 24, 2016 13:25
Calling Async calls synchronously. Taken from this SO post answer - http://r3f.co/1Pscpcr
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
public static class AsyncHelpers
{
/// <summary>
/// Execute's an async Task<T> method which has a void return value synchronously
/// </summary>
[Route("version")]
public ActionResult Version()
{
var version = "DEV Build?";
var descriptionAttribute = this.GetType().Assembly.GetCustomAttributes<AssemblyDescriptionAttribute>().FirstOrDefault();
if ((descriptionAttribute?.Description ?? version) != version && descriptionAttribute.Description.Length > 0)
{
version = descriptionAttribute.Description;
}
return Content(version);
@GordonBeeming
GordonBeeming / SqlUtilCore.cs
Last active April 7, 2021 11:28
A simple sql utility that uses C# 6's FormattableString to suck out SqlParameters to allow for cleaner API.
/***************************************************************************
Module Name: SqlUtilCore.cs
Project: GitHub Gist
Url: http://go.beeming.net/2uMPzq9
A simple sql utility that uses C# 6's FormattableString to suck out SqlParameters to allow for cleaner API.
The MIT License (MIT)
Copyright (c) Gordon Beeming
using System;
using System.Collections.Concurrent;
using System.Configuration;
using System.Runtime.CompilerServices;
namespace Utilities
{
public static class CacheMagics
{
private static bool cachingEnabled = ConfigurationManager.AppSettings["config:CacheMagicsEnabled"] == "1";
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
namespace GordonBeeming.ApiHelpers
{
public static class AsyncHelpers