https://github.com/kmees/MSBuild.NodeTools
Install-Package MSBuild.Npm
Install-Package MSBuild.Gulp
gulp.task('build-Debug', function () {
using System.Collections.Generic; | |
using System.Linq; | |
usingusing System.Collections.Generic; | |
using System.Linq; | |
using System.Web.Mvc; | |
namespace Gists.Mvc.Helpers | |
{ | |
public static class ModelExtensions | |
{ |
https://github.com/kmees/MSBuild.NodeTools
Install-Package MSBuild.Npm
Install-Package MSBuild.Gulp
gulp.task('build-Debug', function () {
public static class Regexes | |
{ | |
public const string Postcode = @"(GIR\s0AA)|(gir\s0aa)|((([A-PR-UWYZa-pr-uwyz][0-9][0-9]?)|(([A-PR-UWYZa-pr-uwyz][A-HK-Ya-hk-y][0-9][0-9]?)|(([A-PR-UWYZa-pr-uwyz][0-9][A-HJKSTUWa-hjkstuw])|([A-PR-UWYZa-pr-uwyz][A-HK-Ya-hk-y][0-9][ABEHMNPRVWXYabehmnprvwxy]))))\s{0,1}[0-9][ABD-HJLNP-UW-Zabd-hjlnp-uw-z]{2})"; | |
public const string Email = @"^([a-zA-Z0-9_\-\.]+)@{1}((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,6}|[0-9]{1,3})$"; | |
public const string Mobile = @"^(((\+?44\s?[127]\d{2,3}|\(?0\d{4}\)?)\s?\d{3}\s?\d{3})|((\+?44\s?\d{3}|\(?0\d{3}\)?)\s?\d{3}\s?\d{4})|((\+?44\s?\d{2}|\(?0\d{2}\)?)\s?\d{4}\s?\d{4}))$"; | |
} |
'use strict'; | |
var directives = angular.module('app', []); | |
// override the default input to update on blur | |
directives.directive('input', function () { | |
return { | |
restrict: 'E', | |
require: 'ngModel', | |
link: function (scope, elm, attr, ngModelCtrl) { | |
if (attr.type === 'radio' || attr.type === 'checkbox') return; |
public class MinDigitsIncluded : ValidationAttribute, IClientValidatable | |
{ | |
private const string DefaultErrorMessage = "{0} must contain at least {1} digits."; | |
public int MinDigits { get; private set; } | |
public MinDigitsIncluded(int minDigits) : base(DefaultErrorMessage) | |
{ | |
MinDigits = minDigits; | |
} |
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] | |
public class DateGreaterThanAttribute : ValidationAttribute, IClientValidatable | |
{ | |
private const string DefaultErrorMessageFormatString = "The {0} field is required."; | |
public string OtherProperty { get; private set; } | |
public DateGreaterThanAttribute(string otherProperty) | |
{ | |
if (string.IsNullOrEmpty(otherProperty)) | |
{ |
public enum Comparison | |
{ | |
IsEqualTo, | |
IsNotEqualTo | |
} | |
/// <summary> | |
/// Validation attribute for required value if another property is set | |
/// </summary> | |
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] | |
public sealed class RequiredIfAttribute : ValidationAttribute, IClientValidatable |
public enum Comparison | |
{ | |
IsEqualTo, | |
IsNotEqualTo | |
} | |
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] | |
public sealed class RegularExpressionIfAttribute : ValidationAttribute, IClientValidatable | |
{ | |
public string RegEx { get; private set; } |
public class CollectionMinMaxLengthValidationAttribute : ValidationAttribute | |
{ | |
const string errorMessage = "{0} must contain at least {1} item(s)."; | |
const string errorMessageWithMax = "{0} must contain between {1} and {2} item(s)."; | |
int minLength; | |
int? maxLength; | |
public CollectionMinMaxLengthValidationAttribute(int min) | |
{ | |
minLength = min; |
public abstract partial class BaseController : Controller | |
{ | |
private const string _langCookie = "lang"; | |
protected override void OnActionExecuting(ActionExecutingContext filterContext) | |
{ | |
SetCurrentCulture(); | |
base.OnActionExecuting(filterContext); | |
} |