Skip to content

Instantly share code, notes, and snippets.

View mattjohnsonpint's full-sized avatar

Matt Johnson-Pint mattjohnsonpint

View GitHub Profile
@mattjohnsonpint
mattjohnsonpint / NodaMapper.cs
Created January 15, 2014 07:59
NPoco mapper for NodaTime
using System;
using NodaTime;
using NPoco;
namespace PocoNoda
{
public class NodaMapper : DefaultMapper
{
public override Func<object, object> GetFromDbConverter(Type DestType, Type SourceType)
{
@mattjohnsonpint
mattjohnsonpint / DatePartFunctions.js
Last active June 25, 2017 00:45
JS replacement functions for timestamp <==> date parts without using the Date object
var d365 = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 ];
var d366 = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 ];
function parts2ts(year, month, day, hour, minute, second, millisecond) {
if (month < 0 || month > 11) {
return NaN;
}
var leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
var days = leap ? d366 : d365;
@mattjohnsonpint
mattjohnsonpint / AvailabilityCalendarExample.cs
Created October 18, 2013 16:51
Example of modeling an availability calendar in RavenDB
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Raven.Client.Indexes;
using Raven.Client.Linq;
using Raven.Imports.Newtonsoft.Json;
using Raven.Json.Linq;
using Raven.Tests.Helpers;
using Xunit;
@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 / 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 / SPTZMap.json
Last active May 15, 2016 08:29
SharePoint time zone ID to reasonable IANA time zone name
[{ "id" : 2, "name" : "Europe/London" },
{ "id" : 3, "name" : "Europe/Paris" },
{ "id" : 4, "name" : "Europe/Berlin" },
{ "id" : 5, "name" : "Europe/Bucharest" },
{ "id" : 6, "name" : "Europe/Budapest" },
{ "id" : 7, "name" : "Europe/Kaliningrad" },
{ "id" : 8, "name" : "America/Sao_Paulo" },
{ "id" : 9, "name" : "America/Halifax" },
{ "id" : 10, "name" : "America/New_York" },
{ "id" : 11, "name" : "America/Chicago" },
@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)
{
using System.Diagnostics;
using System.Linq;
using Raven.Client.Indexes;
using Raven.Imports.Newtonsoft.Json;
using Raven.Tests.Helpers;
using Xunit;
namespace Raven25Tests
{
public class Q19069399 : RavenTestBase

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