Skip to content

Instantly share code, notes, and snippets.

Henrik Frystyk Nielsen HenrikFrystykNielsen

Block or report user

Report or block HenrikFrystykNielsen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:31242d6bd92dc258df05bc8ed259c3c8
{
"action": "opened",
"issue": {
"url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
"number": 1347,
...
},
"repository" : {
"id": 1296269,
"full_name": "octocat/Hello-World",
@HenrikFrystykNielsen
HenrikFrystykNielsen / DbWebHookStore
Last active Sep 26, 2016
Sample SqlWebHookStore structuring allowing for other DbContext and Entity definitions
View DbWebHookStore
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.Core;
using System.Data.Entity.Infrastructure;
@HenrikFrystykNielsen
HenrikFrystykNielsen / gist:a0b9a51645633b7919a1
Created Nov 5, 2015
WebHookSender: Register custom WebHookManager using Autofac
View gist:a0b9a51645633b7919a1
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
@HenrikFrystykNielsen
HenrikFrystykNielsen / WebApiConfig.cs
Created Apr 3, 2014
Workaround for lost NotificationHub ConnectionString. The NotificationHub ConnectionString can get lost after the app has been running for a while. We will be updating the service shortly but in the mean time here is a workaround that fixes the issue.
View WebApiConfig.cs
public static class WebApiConfig
{
public static void Register()
{
ConfigOptions options = new ConfigOptions();
HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));
// Workaround for notification hub connection string going missing.
IServiceSettingsProvider settingsProvider = config.DependencyResolver.GetServiceSettingsProvider();
ServiceSettingsDictionary settings = settingsProvider.GetServiceSettings();
@HenrikFrystykNielsen
HenrikFrystykNielsen / WebApiConfig
Created Mar 28, 2014
Gist of how to hook in additional OWIN authentication providers
View WebApiConfig
using System.Web.Http;
using Autofac;
using Microsoft.WindowsAzure.Mobile.Service;
using Microsoft.WindowsAzure.Mobile.Service.Config;
using Owin;
namespace henrikntest09Service
{
public static class WebApiConfig
{
View Program.cs
using System;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http.SelfHost;
namespace leveldb_sharp_sample
{
public class WebHost
@HenrikFrystykNielsen
HenrikFrystykNielsen / HttpContentProcessor.cs
Created Jul 2, 2012
Sample showing a DelegatingHandler which plugs in a special HttpContent wrapper for saving response content to local disk and perform asynchronous post-processing on that file. This allows content from a response to be post-processed, for example to send
View HttpContentProcessor.cs
using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
namespace ResponseEntityProcessor.Handlers
{
/// <summary>
/// Wraps an inner <see cref="HttpContent"/> and forces the content to be written
@HenrikFrystykNielsen
HenrikFrystykNielsen / SampleFilter.cs
Created Jun 28, 2012
Sample ActionFilter with pre- and post-action synchronous processing
View SampleFilter.cs
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
namespace ActionFilter
{
public class SampleFilter : ActionFilterAttribute
{
public override void OnActionExecuting(HttpActionContext actionContext)
{
}
@HenrikFrystykNielsen
HenrikFrystykNielsen / CardStatus.cs
Created Jun 27, 2012
Asynchronous HTML form data submit using async/await in .NET 4.5 and FormUrlEncodedContent
View CardStatus.cs
using System;
using System.Collections.Generic;
using System.Net.Http;
namespace CardStatus
{
class Program
{
static async void RunCheck(int antragsnummer)
{
@HenrikFrystykNielsen
HenrikFrystykNielsen / SampleHandler.cs
Created Jun 14, 2012
Sample HttpMessageHandler doing async retrieval using .NET 4.5
View SampleHandler.cs
using System;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace SelfHost.MessageHandlers
{
/// <summary>
/// This sample HttpMessageHandler illustrates how to perform an async operation as part of the
You can’t perform that action at this time.