Skip to content

Instantly share code, notes, and snippets.

View crozone's full-sized avatar
💭
Working on ipodloader2 and Tetris for macOS 9

Ryan Crosby crozone

💭
Working on ipodloader2 and Tetris for macOS 9
  • Unique Micro Design Pty Ltd.
  • Australia
  • 12:24 (UTC +10:00)
View GitHub Profile
@crozone
crozone / HttpResponseMessageExtensions.cs
Last active August 26, 2021 01:45
EnsureSuccessStatusCodeWithStatus (HttpResponseMessageExtensions)
// Copyright 2021 Ryan Crosby
// This code is licensed under the MIT license
/// <summary>
/// Variations of the EnsureSuccessStatusCode() extension method for capturing and retreiving the HTTP Status Code and Response Body.
/// </summary>
public static class HttpResponseMessageExtensions
{
public const string StatusCodeKey = "StatusCode";
public const string ResponseBodyKey = "ResponseBody";
@crozone
crozone / HtmlExtensions.cs
Last active August 26, 2021 01:46
Html.DescriptionFor() extension method for ASP.NET Core 3.1 and 5
// Copyright 2021 Ryan Crosby
// This code is licensed under the MIT license
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Linq.Expressions;
@crozone
crozone / .vimrc
Created January 26, 2021 04:04
Good, sane .vimrc. Background=dark and mouse disabled.
syntax on
set background=dark
set showcmd
set showmatch
set mouse=
@crozone
crozone / csharp-bytes-to-hex-fast.cs
Last active December 17, 2023 19:32
C# Bytes to Hex with Span and stackalloc.
// Copyright 2022 Ryan Crosby
// This code is licensed under the MIT license
//
// Methods to convert a byte array to hex, using new Span<T>
//
// C# no-alloc optimization that directly wraps the data section of the dll (similar to string constants)
// https://github.com/dotnet/roslyn/pull/24621
private static ReadOnlySpan<byte> HexAlphabetBytes => new byte[16]