Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Don Waldo dgwaldo

🏠
Working from home
View GitHub Profile
@dgwaldo
dgwaldo / AuthenticationController.cs
Last active Aug 1, 2018
Swashbuckle - Auth0 Implicit Grant
View AuthenticationController.cs
[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 Oct 2, 2021
MS Dev ENV
View devbox.txt
# 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/a3f4d483e51baa0d56fded4f49a0e2d1b78c2132/devbox.txt -DisableReboots
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
cinst IIS-WebServerRole -source windowsfeatures
@dgwaldo
dgwaldo / AppMessengerService.ts
Last active Jan 15, 2018
Messaging with RxJS
View AppMessengerService.ts
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 Nov 4, 2017
Test setup for EF Core using InMemoryDb
View InMemoryDbTestExample.cs
[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 Feb 28, 2016
Client Side Collection Editing with Unobtrusive Validation
View Asset.cshtml
//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 Jan 24, 2016
Editing MVC Collections Client Side
View Model Binding Example
@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 Jun 6, 2015
PowerShell Pester Test Example
View Configure-IIS
$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 Jun 6, 2015
Installing Apps with Chocolatey
View ChocolateyExample
#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 Aug 29, 2015
WellSurveyPlot3DValuesViewModel extends the WellSurveyPlot3DViewModel
View WellSurveyPlot3DValuesViewModel
/// <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 Nov 12, 2014
Web API - [FromUri] example
View QueryRequest Object
public class QueryRequest
{
public QueryRequest()
{
Query = null;
Page = 1;
PageSize = 10;
}
public string Query { get; set; }
public int Page { get; set; }