Skip to content

Instantly share code, notes, and snippets.

View mattjohnsonpint's full-sized avatar

Matt Johnson-Pint mattjohnsonpint

View GitHub Profile
@mattjohnsonpint
mattjohnsonpint / HotRestartWorkaround.xml
Last active October 19, 2023 14:25
Workaround for Visual Studio Hot Restart issue
<!--
This target ensures that iOS Frameworks and XCFrameworks are collected from NuGet packages when using Hot Restart.
_UnpackHotRestartFrameworkAssemblies doesn't work for NuGet packages, because the frameworks aren't stored as embedded resources, but just files in the package.
-->
<Target Name="_CollectHotRestartFrameworksFromPackages" BeforeTargets="_CollectHotRestartFrameworks" Condition="'$(IsHotRestartBuild)' == 'true'">
<!--
Find all resources within NuGet packages.
For example, a package with assembly Foo.dll will have an adjacent Foo.resources folder or a Foo.resources.zip file.
-->
@mattjohnsonpint
mattjohnsonpint / LICENSE
Last active October 9, 2024 19:32
Unified global Unhandled Exception event for .NET MAUI
MIT License
Copyright (c) 2022 Matt Johnson-Pint
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@mattjohnsonpint
mattjohnsonpint / dateonlybetween.cs
Created May 21, 2021 21:48
DateOnly Between methods
public static int DaysBetween(DateOnly startDate, DateOnly endDate)
{
return endDate.DayNumber - startDate.DayNumber;
}
public static (int Months, int Days) MonthsAndDaysBetween(DateOnly startDate, DateOnly endDate)
{
int months = (endDate.Year - startDate.Year) * 12 + endDate.Month - startDate.Month;
DateOnly testDate = startDate.AddMonths(months);
@mattjohnsonpint
mattjohnsonpint / PathModelBinderAttribute.cs
Created November 15, 2018 21:55
Path Model Binder for ASP.NET Core
using System;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace MyNameSpace
{
public class PathModelBinderAttribute : ModelBinderAttribute
{
@mattjohnsonpint
mattjohnsonpint / Program.cs
Created January 30, 2017 23:02
Just playing with clocks
using System;
using System.Runtime.InteropServices;
namespace PreciseTimeTest
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("------------------------------------");
@mattjohnsonpint
mattjohnsonpint / Egypt_2016_DST_Cancellation.reg
Last active July 7, 2016 05:06
Windows Registry Patch for Egypt 2016 Cancellation of DST
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Egypt Standard Time]
"TZI"=hex:88,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Egypt Standard Time\Dynamic DST]
"2016"=hex:88,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"2017"=-
@mattjohnsonpint
mattjohnsonpint / windowsZones-override.xml
Last active June 15, 2016 04:13
CLDR Overrides for June 2016
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE supplementalData SYSTEM "../../common/dtd/ldmlSupplemental.dtd">
<!--
Copyright © 1991-2013 Unicode, Inc.
CLDR data files are interpreted according to the LDML specification (http://unicode.org/reports/tr35/)
For terms of use, see http://www.unicode.org/copyright.html
-->
<supplementalData>
<version number="$Revision$"/>
@mattjohnsonpint
mattjohnsonpint / railstz.json
Created May 11, 2016 06:12
Rails TZ Map in JSON
{
"International Date Line West":"Pacific/Midway",
"Midway Island":"Pacific/Midway",
"American Samoa":"Pacific/Pago_Pago",
"Hawaii":"Pacific/Honolulu",
"Alaska":"America/Juneau",
"Pacific Time (US & Canada)":"America/Los_Angeles",
"Tijuana":"America/Tijuana",
"Mountain Time (US & Canada)":"America/Denver",
"Arizona":"America/Phoenix",
@mattjohnsonpint
mattjohnsonpint / Program.cs
Created February 9, 2016 05:06
Testing ISO8601 formatting performance
using System;
using System.Diagnostics;
using System.Globalization;
namespace DateTimeToIsoStringPerfTests
{
class Program
{
static void Main(string[] args)
{

moment 2.11.1 changelog

Bugfixes:

  • #2881 Revert "Merge pull request #2746 from mbad0la:develop" Sep->Sept
  • #2868 Add format and parse token Y, so it actually works
  • #2865 Use typeof checks for undefined for global variables
  • #2858 Fix Date mocking regression introduced in 2.11.0
  • #2864 Include changelog in npm release
  • #2830 dep: add grunt-cli
  • #2869 Fix months parsing for some locales