Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Williams negativeeddy

View GitHub Profile
@negativeeddy
negativeeddy / parameters.template.json
Created Jun 25, 2019
Virtual Assistant parameters template that uses free or least expensive resources
View parameters.template.json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appInsightsLocation": {
"value": "westus2"
},
"contentModeratorLocation": {
"value": "westus"
@negativeeddy
negativeeddy / AsyncVsAbort.cs
Created Aug 27, 2018
code snippet for blog regarding Threading Abort and async/await
View AsyncVsAbort.cs
using System;
using System.Threading;
using System.Threading.Tasks;
namespace AsyncVsAbort
{
class Program
{
static void Main(string[] args)
{
@negativeeddy
negativeeddy / main.cs
Created Dec 8, 2017
async Main method in C#
View main.cs
static async Task Main(string[] args)
{
HttpClient client = new HttpClient();
string result = await client.GetStringAsync("http://www.bing.com");
Console.WriteLine(result);
}
@negativeeddy
negativeeddy / clean-devfolders.ps1
Last active Sep 21, 2016
This is a powershell script that will recursively remove all the obj, bin, and packages directories from the current directory and its children.
View clean-devfolders.ps1
get-childitem -Directory -Recurse | where-object {$_.Name -eq 'bin' -or $_.Name -eq 'obj' -or $_.Name -eq 'packages'} | Remove-Item -Force -Recurse
@negativeeddy
negativeeddy / Settings.cs
Last active Sep 30, 2016
This is how I do strongly typed application settings. Either pass the Dictionary in if provided by the system, or serialize/deserialize to disk as needed.
View Settings.cs
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace NegativeEddy.Settings
{
public class ApplicationSettings
{
Dictionary<string, object> _settingsBag;
public void Load()
@negativeeddy
negativeeddy / Task Exception Policy Test.cs
Created Feb 18, 2016
The is a simple c# console app that demonstrates various behaviors when .NET Tasks do or do not have their exceptions observed.
View Task Exception Policy Test.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace UnobservedExceptions
{
// NOTES:
@negativeeddy
negativeeddy / Task Exception Await vs Forget.cs
Last active Feb 18, 2016
TPL exception behavior test. This demonstrates exception behavior based on whether the Task is ignored or awaited deep inside a callstack.
View Task Exception Await vs Forget.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace async_exception_test
{
class Program
{