Skip to content

Instantly share code, notes, and snippets.

@mattwhetton
mattwhetton / HttpsRedirectMiddleware.cs
Last active November 24, 2020 23:22
Simple OWIN middleware for doing an HTTPs redirect for all requests
// Ref: http://www.codenutz.com/https-redirect-asp-net-core-using-owin-middleware/
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Builder;
namespace SomeNamespace
{
public class HttpsRedirectMiddleware {
using System;
using System.Globalization;
using Android.Graphics;
using Android.Graphics.Drawables;
using Cirrious.CrossCore.Converters;
using DecisionBuddy.Controls;
using DecisionBuddy.Controls.Utils;
using DecisionBuddy.Core.Model;
namespace DecisionBuddy.UI.Droid.Converters
@mattwhetton
mattwhetton / EnumerableExtensions.cs
Created January 28, 2018 12:51
Extension method for cutting an enumerable into batches
public static class EnumerableExtensions
{
public static IEnumerable<IEnumerable<T>> Batches<T>(this IEnumerable<T> items, int batchSize)
{
if (batchSize <= 0)
{
throw new ArgumentException("Batch size must be greater than 0");
}
var itemsList = items as IList<T> ?? items.ToList();
@mattwhetton
mattwhetton / docker-compose.yml
Created May 13, 2018 19:40
Simple Rabbitmq Docker Compose
version: '3'
services:
rabbitMq:
image: rabbitmq:3-management
ports:
- "15672:15672"
- "5672:5672"
- "5671:5671"
environment:
RABBITMQ_DEFAULT_PASS: pass