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
########################################################### | |
# | |
# Script to upgrade all NuGet packages in solution to latest version | |
# https://gist.github.com/1082558 | |
# | |
# USAGE | |
# Place this file (Upgrade-Packages.ps1) to your solution folder. | |
# From Package Manager Console execute | |
# | |
# .\Upgrade-Packages.ps1 -PackageFilter:Castle.* |
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
using System.Web.Mvc; | |
using Newtonsoft.Json; | |
public class JsonModelBinder : DefaultModelBinder | |
{ | |
public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) | |
{ | |
var providerResult = bindingContext.ValueProvider.GetValue(bindingContext.ModelName); | |
var json = providerResult.AttemptedValue; |
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
public class JsonpResult : ContentResult | |
{ | |
public object Model { get; set; } | |
public string Callback { get; set; } | |
public JsonpResult() | |
{ | |
ContentType = "application/javascript"; | |
} |
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
using System; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
public static class ExpressionHelpers | |
{ | |
public static T GetValue<T>(this Expression<Func<T>> source) | |
{ | |
T unknownValue = source.Compile().Invoke(); |
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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Globalization; | |
using System.Web.Mvc; | |
using System.Web.Script.Serialization; | |
public class JsonValueProviderFactory : ValueProviderFactory | |
{ | |
public JsonValueProviderFactory(string keyName, Type modelType) |
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
using System; | |
using System.Web; | |
using System.Web.Mvc; | |
public static class UrlExtensions | |
{ | |
public static string ExternalAction(this UrlHelper url, string actionName, string controllerName, object routeValues = null) | |
{ | |
var requestUrl = url.Action(actionName, controllerName, routeValues); | |
return ExternalUrl(url, requestUrl); |
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
param($installPath, $toolsPath, $package, $project) | |
Write-Host "Setting Application to DowJones.Web.Mvc.HttpApplication..." | |
# Read the transformed text from the custom template included in the package | |
$customGlobalAsax = $project.ProjectItems | where { $_.Name -eq "Global.asax.cs.custom" } | |
$customGlobalAsax.Open() | |
$customGlobalAsax.Document.Activate() | |
$customGlobalAsax.Document.Selection.SelectAll(); | |
$replacementGlobalAsax = $customGlobalAsax.Document.Selection.Text; |
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
function status() { | |
if(Test-Path .svn) { | |
Write-Host | |
svn status | |
Write-Host | |
} | |
if(Test-Path .git) { | |
git status | |
} |
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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Web.Script.Serialization; | |
public class Roles : List<Role> | |
{ | |
public Roles(IEnumerable<Role> roles = null) | |
: base(roles ?? Enumerable.Empty<Role>()) |
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
using System.Web.Mvc; | |
using System.Web.Mvc.Html; | |
public static class HtmlHelperEnumExtensions | |
{ | |
public static IHtmlString EnumDropDownListFor<TModel, TEnum>(this HtmlHelper<TModel> helper, Expression<Func<TModel, TEnum>> field, TEnum selectedValue = default(TEnum)) | |
where TEnum : struct | |
{ | |
var name = (field.Body as MemberExpression).Member.Name; |
OlderNewer