Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond as I'm super busy with bill paying client work!

James Randall JamesRandall

💭
I may be slow to respond as I'm super busy with bill paying client work!
Block or report user

Report or block JamesRandall

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
@JamesRandall
JamesRandall / RedirectNewtonsoftJson.ps1
Last active Feb 8, 2019
Powershell binding redirection
View RedirectNewtonsoftJson.ps1
# Load your target version of the assembly
$newtonsoft = [System.Reflection.Assembly]::LoadFrom("$PSScriptRoot\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll")
$onAssemblyResolveEventHandler = [System.ResolveEventHandler] {
param($sender, $e)
# You can make this condition more or less version specific as suits your requirements
if ($e.Name.StartsWith("Newtonsoft.Json")) {
return $newtonsoft
}
foreach($assembly in [System.AppDomain]::CurrentDomain.GetAssemblies()) {
if ($assembly.FullName -eq $e.Name) {
@JamesRandall
JamesRandall / HttpEventListener.cs
Last active Mar 13, 2019
Http Tracing in .net
View HttpEventListener.cs
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Diagnostics.Tracing;
using System.Globalization;
namespace HttpTracing
{
public class HttpEventListener : EventListener
{
@JamesRandall
JamesRandall / AllowMarkdownCorsModule.cs
Last active Apr 9, 2016
Enable serving of static Markdown content to JavaScript running on any domain
View AllowMarkdownCorsModule.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MyWebsite.Helpers
{
public class AllowMarkdownCorsModule : IHttpModule
{
public void Init(HttpApplication context)
@JamesRandall
JamesRandall / BlobStorageMultipartStreamProvider.cs
Last active Mar 12, 2019
Azure Blob Container Web API Image Upload
View BlobStorageMultipartStreamProvider.cs
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
You can’t perform that action at this time.