View CacheMagics.cs
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";
View TestingIsBoolean.cs
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace TestingIsBoolean
{
class Program
{
static void Main(string[] args)
{
var summary = BenchmarkRunner.Run<Tests>();
View Export-All-Azure-App-Service-Certificates.ps1
$AzureLoginEmailId = (Get-AzureRmContext).Account.Id
$CurrentUserObjectId = Get-AzureRmADUser |? { $_.UserPrincipalName -like "$($AzureLoginEmailId.Replace("@","_"))*" } | Select-Object -ExpandProperty Id
$ExportCertsExpiringInMoreThanXDays = 30
$Certificates = Get-AzureRmWebAppCertificate
foreach($Certificate in $Certificates)
{
if ($ExportCertsExpiringInMoreThanXDays -eq -1 -or $Certificate.ExpirationDate.AddDays(-$ExportCertsExpiringInMoreThanXDays) -gt [DateTime]::UtcNow)
{
View Git-Push-All-To-Remote.bat
git remote add new http://gordonpc:8080/tfs/testcoll/testtp/_git/OpenLiveWriter
git push -u new --all
View Git-Checkout-Branches.bat
git checkout -b FixBase64ImageDownload origin/FixBase64ImageDownload
git checkout -b bringup origin/bringup
git branch -a
View Git-Clone-OpenLiveWriter-Repo.bat
git clone http://gordonpc:8080/tfs/DefaultCollection/GitHub-Projects/_git/OpenLiveWriter
cd OpenLiveWriter
View SqlUtilCore.cs
/***************************************************************************
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
View html-2-pdf-usage.cs
public async Task<ActionResult> DownloadHomePageAsPdf()
{
var bytes = await TheMagic.Go($"{Request.Url.GetLeftPart(UriPartial.Authority)}/Home");
return File(bytes, "application/pdf");
}
View html-2-pdf.cs
using System;
using System.IO;
using System.Threading.Tasks;
using System.Web;
namespace Html2Pdf.Lib
{
public static class TheMagic
{
public static async Task<byte[]> Go(string url, int timeoutInSeconds = 30, string pathToExe = null)