This file contains hidden or 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
| (function ($) { | |
| 'use strict'; | |
| $.debounce = function (delay, fn) { | |
| var timer = null; | |
| return function () { | |
| var context = this, args = arguments; | |
| clearTimeout(timer); | |
| timer = setTimeout(function () { | |
| fn.apply(context, args); | |
| }, delay); |
This file contains hidden or 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
| public class NotifyPropertyBase : INotifyPropertyChanged | |
| { | |
| public event PropertyChangedEventHandler PropertyChanged; | |
| protected virtual void OnPropertyChanged( Expression<Func<object>> propertyExpression ) | |
| { | |
| PropertyChangedEventHandler handler = PropertyChanged; | |
| if (handler != null) handler( this, new PropertyChangedEventArgs( GetPropertyName( propertyExpression ) ) ); | |
| } | |
| private string GetPropertyName( Expression<Func<object>> propertyExpression ) |
This file contains hidden or 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
| param($installPath, $toolsPath, $package, $project) | |
| $projectItems = $project.ProjectItems | |
| $isWPFProject = Select-String -Simple "{60DC8134-EBA5-43B8-BCC9-BB4BC16C2548}" $project.FullName #WPF project guid | |
| $isWinFormsProject = Select-String -Simple "FlavorProperties" $project.FullName #WinForms project doesn't support FlavorProperties so should be empty | |
| if(([string]::IsNullOrEmpty($isWPFProject) -eq $false) -or ([string]::IsNullOrEmpty($isWinFormsProject) -eq $true)) { | |
| #terminal app project | |
| Write-Host "Detected terminal application project (WebForms or WPF)" | |
| $projectItems.Item("log4net.config").Delete() |
This file contains hidden or 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
| protected void Application_Error(Object sender, EventArgs e) | |
| { | |
| var httpContext = ((MvcApplication)sender).Context; | |
| var currentRouteData = RouteTable.Routes.GetRouteData(new HttpContextWrapper(httpContext)); | |
| var currentController = " "; | |
| var currentAction = " "; | |
| if (currentRouteData != null) | |
| { |
This file contains hidden or 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
| /** | |
| * WkHtmlToPdf table splitting hack. | |
| * | |
| * Script to automatically split multiple-pages-spanning HTML tables for PDF | |
| * generation using webkit. | |
| * | |
| * To use, you must adjust pdfPage object's contents to reflect your PDF's | |
| * page format. | |
| * The tables you want to be automatically splitted when the page ends must | |
| * have a class name of "splitForPrint" (can be changed). |
This file contains hidden or 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
| public class CustomHandleErrorAttribute : HandleErrorAttribute | |
| { | |
| private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | |
| public override void OnException(ExceptionContext filterContext) | |
| { | |
| if (!filterContext.HttpContext.IsCustomErrorEnabled) | |
| { | |
| return; | |
| } |
This file contains hidden or 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
| [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] | |
| public class ValidateGlobalAntiForgeryTokenAttribute : FilterAttribute, IAuthorizationFilter | |
| { | |
| private readonly ValidateAntiForgeryTokenAttribute validator; | |
| private readonly AcceptVerbsAttribute acceptedVerbs; | |
| public ValidateGlobalAntiForgeryTokenAttribute() | |
| { | |
| this.validator = new ValidateAntiForgeryTokenAttribute(); |
This file contains hidden or 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
| [TestFixture] | |
| public class HtmlHelperTests | |
| { | |
| // here put some tests... | |
| public static HtmlHelper<T> CreateHtmlHelper<T>() where T : new () | |
| { | |
| ViewDataDictionary viewData = new ViewDataDictionary(new T()); | |
| var controllerContext = new ControllerContext( |
This file contains hidden or 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
| using System.IO; | |
| using System.Reflection; | |
| using System.Web; | |
| using System.Web.SessionState; | |
| using NUnit.Framework; | |
| namespace Mvc.Tests | |
| { | |
| [TestFixture] |
This file contains hidden or 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
| using System; | |
| using System.Collections.Specialized; | |
| using System.Web; | |
| using System.Web.Mvc; | |
| using System.Web.Routing; | |
| using Moq; | |
| namespace Mvc.Tests | |
| { |