Skip to content

Instantly share code, notes, and snippets.

View JamesRandall's full-sized avatar

James Randall JamesRandall

View GitHub Profile
@JamesRandall
JamesRandall / todo.jsx
Last active August 2, 2016 06:56 — forked from caike/todo.jsx
Simple Todo app demo using React + ES6
var allItems = []
allItems.push("Buy ingredients for Crock Pot");
allItems.push("Pick up chair at IKEA");
allItems.push("Go see mom");
class TodoList extends React.Component {
constructor(props){
super(props);
}
getInitialState() {
@JamesRandall
JamesRandall / RedirectNewtonsoftJson.ps1
Last active May 2, 2023 13:39
Powershell binding redirection
# 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 August 16, 2023 10:32
Http Tracing in .net
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 April 9, 2016 19:53
Enable serving of static Markdown content to JavaScript running on any domain
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 March 19, 2020 23:12
Azure Blob Container Web API Image Upload
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;