Skip to content

Instantly share code, notes, and snippets.

View dphoebus's full-sized avatar
😏

Daniel Phoebus dphoebus

😏
  • CaptiveAire, Inc.
View GitHub Profile
@dphoebus
dphoebus / SlackClient.cs
Created August 8, 2017 21:03 — forked from jogleasonjr/SlackClient.cs
A simple C# class to post messages to a Slack channel. You must have the Incoming WebHooks Integration enabled. This class uses the Newtonsoft Json.NET serializer available via NuGet. Scroll down for an example test method and a LinqPad snippet. Enjoy!
using Newtonsoft.Json;
using System;
using System.Collections.Specialized;
using System.Net;
using System.Text;
//A simple C# class to post messages to a Slack channel
//Note: This class uses the Newtonsoft Json.NET serializer available via NuGet
public class SlackClient
{
@dphoebus
dphoebus / introrx.md
Created August 11, 2017 07:15 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@dphoebus
dphoebus / web.config
Created August 21, 2017 17:21 — forked from emyann/web.config
ASP.NET web.config configuration for Single Page Application (AngularJS) running on IIS with OwinHttpHandler
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<rewrite>
<rules>
@dphoebus
dphoebus / CSS for <sup> and <sub>
Created September 6, 2017 20:00 — forked from unruthless/CSS for <sup> and <sub>
CSS for <sub> and <sup>
sub, sup {
/* Specified in % so that the sup/sup is the
right size relative to the surrounding text */
font-size: 75%;
/* Zero out the line-height so that it doesn't
interfere with the positioning that follows */
line-height: 0;
/* Where the magic happens: makes all browsers position
@dphoebus
dphoebus / OIDC and OAuth2 Flows.md
Created September 11, 2017 05:36 — forked from jawadatgithub/OIDC and OAuth2 Flows.md
Enrich IdentityServer3 Documentation with OIDC (OpenID Connect) and OAuth2 Flows section
Note for community:

A. IdentityServer3 docs, samples and source code use OIDC & OAuth2 terms interchangeably to refer to same thing in many areas. I think that's make sense because OIDC introduced as complement & extension for OAuth2.

B. IdentityServer3, STS, OP, OIDC server, OAuth2 server, CSP, IDP and others: means same thing (software that provide/issue tokens to clients) as explained in [Terminology] (http://identityserver.github.io/Documentation/docs/overview/terminology.html).

C. Grants and flows mean same thing, grant was the common term in OAuth2 specs and flow is the common term in OIDC specs.

D. This document will not focus on custom flow/grant.

E. [Important] Choosing wrong flow leads to security threat.

@dphoebus
dphoebus / CustomHandleErrorAttribute.cs
Created September 12, 2017 11:08 — forked from lkaczanowski/CustomHandleErrorAttribute.cs
Custom ASP.NET MVC handle error attribute. Handles and logs all errors.
public class CustomHandleErrorAttribute : HandleErrorAttribute
{
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public override void OnException(ExceptionContext filterContext)
{
if (!filterContext.HttpContext.IsCustomErrorEnabled)
{
return;
}
@dphoebus
dphoebus / CustomHandleErrorAttribute.cs
Created September 12, 2017 11:08 — forked from lkaczanowski/CustomHandleErrorAttribute.cs
Custom ASP.NET MVC handle error attribute. Handles and logs all errors.
public class CustomHandleErrorAttribute : HandleErrorAttribute
{
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public override void OnException(ExceptionContext filterContext)
{
if (!filterContext.HttpContext.IsCustomErrorEnabled)
{
return;
}
@dphoebus
dphoebus / Example1.cs
Created September 21, 2017 14:56 — forked from davidfowl/Example1.cs
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@dphoebus
dphoebus / gist:b5f3f6c011a07e167052ec211371fe6c
Created October 6, 2017 01:27 — forked from m3dwards/gist:4588041
MongoDB C# Driver Example
using System;
using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Driver.Builders;
using MongoDB.Driver.GridFS;
using MongoDB.Driver.Linq;
using MelvilleAdmin.Models;
@dphoebus
dphoebus / gist:35de2c9638c4557fd8a3f91f6bfc888f
Created November 8, 2017 20:29 — forked from joliver/gist:1311195
NServiceBusCommitDispatcher
public sealed class NServiceBusCommitDispatcher : IPublishMessages
{
private const string AggregateIdKey = "AggregateId";
private const string CommitVersionKey = "CommitVersion";
private const string EventVersionKey = "EventVersion";
private const string BusPrefixKey = "Bus.";
private readonly IBus bus;
public NServiceBusCommitDispatcher(IBus bus)
{