Skip to content

Instantly share code, notes, and snippets.

View dgwaldo's full-sized avatar
🏠
Working from home

Don W. dgwaldo

🏠
Working from home
View GitHub Profile
@dgwaldo
dgwaldo / AuthenticationController.cs
Last active August 1, 2018 13:31
Swashbuckle - Auth0 Implicit Grant
[ApiExplorerSettings(IgnoreApi = true)]
[AllowAnonymous]
[Route("api/[controller]")]
[ApiController]
public class AuthenticationController : ControllerBase {
private readonly Auth0Settings _auth0Settings;
public AuthenticationController(
IOptions<Auth0Settings> auth0Settings
@dgwaldo
dgwaldo / devbox.txt
Last active April 17, 2023 18:25
MS Dev ENV
# Manually Unblock Powershell Policy "Set-ExecutionPolicy Unrestricted -Force"
# First install Chocolatey from https://chocolatey.org/
# Refer to http://boxstarter.org/Learn/WebLauncher
# -- Run the below code from an admin PS console --
# Install-BoxstarterPackage -PackageName https://gist.githubusercontent.com/dgwaldo/67a5f87f9590cc29385014864e79b6e7/raw/713d60c629809c1735ed8e980739579f9e44a62a/devbox.txt -DisableReboots
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
cinst IIS-WebServerRole -source windowsfeatures
@dgwaldo
dgwaldo / AppMessengerService.ts
Last active January 15, 2018 02:33
Messaging with RxJS
import { Subject } from "rxjs";
import { Injectable } from "@angular/core";
@Injectable()
export class AppMessengerService {
constructor() {
this.message$ = new Subject();
}
// Subscribe to this to listen for messages.
@dgwaldo
dgwaldo / InMemoryDbTestExample.cs
Last active November 4, 2017 09:00
Test setup for EF Core using InMemoryDb
[TestClass]
public class ExampleRepositoryTests {
[TestMethod]
public void Get_Overload_Should_Return_Paged_Contacts_Obj() {
//Arrange
var options = GetOptions(nameof(this.Get_Overload_Should_Return_Paged_Contacts_Obj));
using (var context = new ContactSheetsDbContext(options)) {
LoadContactsIntoDb(context);
}
@dgwaldo
dgwaldo / Asset.cshtml
Last active February 28, 2016 07:46
Client Side Collection Editing with Unobtrusive Validation
//This is the template for our collection item, it is a Shared/EditorTemplate file.
@model Domain.Models.Themes.Asset
@{
var assetTypes = ViewData["AssetTypes"] as SelectList;
}
<div class="row">
<div class="col-md-2">
@Html.DropDownListFor(m => m.AssetType, assetTypes, new { @class = "form-control" })
@dgwaldo
dgwaldo / Model Binding Example
Created January 24, 2016 01:17
Editing MVC Collections Client Side
@model Domain.Models.Theme.Asset
<div class="form-group">
@Html.LabelFor(model => model.Url, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Url, new { htmlAttributes = new { @class = "form-control", @id = "${index}" } })
@Html.ValidationMessageFor(model => model.Url, "", new { @class = "text-danger" })
</div>
</div>
@dgwaldo
dgwaldo / Configure-IIS
Created June 6, 2015 18:05
PowerShell Pester Test Example
$ScriptDir = Split-Path -parent $MyInvocation.MyCommand.Path
Import-Module $ScriptDir\..\Modules\Config-IIS-Params.psm1
Import-Module $ScriptDir\..\Modules\New-SelfSignedCertificate
$cnAriEndeavor = "App"
$storefrontPath = $Env:USERPROFILE + "\Documents\storefront\sfProj"
Function Configure-IIS-Storefront([string]$sitePath){
$siteName = "Storefront"
$appPoolName = "Storefront"
@dgwaldo
dgwaldo / ChocolateyExample
Created June 6, 2015 17:54
Installing Apps with Chocolatey
#Install Chocolatey
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
#Install Apps using Chocolatey
cinst webpi -y #Web Platform Installer
cinst curl -y
cinst notepadplusplus -y
cinst googlechrome -y
cinst git -y -InstallArguments "/GitAndUnixToolsOnPath"
cinst fiddler -y
cinst resharper -y
@dgwaldo
dgwaldo / WellSurveyPlot3DValuesViewModel
Last active August 29, 2015 14:10
WellSurveyPlot3DValuesViewModel extends the WellSurveyPlot3DViewModel
/// <summary>
/// Extends the WellSurveyPlot3DViewModel to provide methods and properties for
/// viewing values along the path of a pipe, internal to the well-bore.
/// </summary>
public class WellSurveyPlot3DValuesViewModel : WellSurveyPlot3DViewModel
{
private double _maxValueOnPipe;
private double _minValueOnPipe;
public WellSurveyPlot3DValuesViewModel(List<WellXyzPoint> globalXyz)
@dgwaldo
dgwaldo / QueryRequest Object
Created November 12, 2014 18:24
Web API - [FromUri] example
public class QueryRequest
{
public QueryRequest()
{
Query = null;
Page = 1;
PageSize = 10;
}
public string Query { get; set; }
public int Page { get; set; }