Skip to content

Instantly share code, notes, and snippets.

View jonathascosta's full-sized avatar

Jonathas Costa jonathascosta

  • Porto, Portugal
View GitHub Profile
@jonathascosta
jonathascosta / gist:987676
Created May 23, 2011 21:41 — forked from juanplopes/gist:987646
String Extensions
public static class TypeExtensions
{
public static Type GetValueTypeIfNullable(this Type type)
{
return type.IsNullable() ? type.GetGenericArguments()[0] : type;
}
public static bool IsNullable(this Type type)
{
return (type.IsGenericType && typeof(Nullable<>) == type.GetGenericTypeDefinition());
@jonathascosta
jonathascosta / DateExtensions.js
Created September 5, 2016 20:26 — forked from anonymous/DateExtensions.js
Date Extensions for Javascript
Date.prototype.clone = function () {
return new Date(this.valueOf());
}
Date.prototype.addDays = function (days) {
var d = this.clone();
d.setDate(d.getDate() + days);
return d;
}