This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2010, 2012 Matt Enright | |
// 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: | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git diff --name-only |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mock<T> : Moq.Mock<T> where T : class { | |
public static implicit operator T(Mock<T> mock) | |
{ | |
return mock == null ? null : mock.Object; | |
} | |
} | |
class Dingus<T> : Mock<T> where T : class { | |
public Dingus () | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $time = $('#details time'), | |
iso = /^(\d{4}|[+\-]\d{6})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?))?/; | |
parse = function (date) { | |
var timestamp = Date.parse (date), | |
minutesOffset = 0, | |
s; | |
if (isNaN (timestamp) && (s = iso.exec (date))) { | |
if (s[8] !== 'Z') { | |
minutesOffset = +s[10] * 6- + (+s[11]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class T : IEquatable<T> { | |
public sealed override int GetHashCode () | |
{ | |
return 4; // guaranteed to be random | |
} | |
public sealed override bool Equals (object o) | |
{ | |
var t = o as T; | |
return t != null && Equals (t); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new[] { | |
new DateTime (2012, 01, 01, 13, 0, 0), | |
new DateTime (2012, 01, 01, 9, 0, 0), | |
new DateTime (2012, 01, 02, 1, 0, 0), | |
new DateTime (2012, 01, 02, 23, 10, 0), | |
}.OrderBy (dt => dt.Date) | |
.ThenByDescending (dt => dt); |