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 Attribute : ActionFilterAttribute { | |
public override void OnActionExecuted(ActionExecutedContext filterContext) { | |
base.OnActionExecuted(filterContext); | |
if (!filterContext.ExceptionHandled) { | |
var exception = filterContext.Exception; | |
if (exception is CustomException) { | |
filterContext.Controller.ViewData.ModelState.Add(String.Empty, Resource.CustomExceptionMessage); | |
} |
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.Linq; | |
using System.Web; | |
using System.Web.Mvc; | |
using System.Diagnostics; | |
using System.IO; | |
// Please try to run both: Cassini and IIS. | |
// For IIS select Application Pool with Process Identity == Your identity |
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.Linq; | |
using System.Web; | |
using System.Web.Mvc; | |
namespace MvcForDebug2.Infrastructure { | |
public class ServiceAttribute : ActionFilterAttribute { | |
public override void OnActionExecuted(ActionExecutedContext filterContext) { | |
if (filterContext.RequestContext.HttpContext.Request.IsAjaxRequest()) { |
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
<?xml version="1.0"?> | |
<configuration> | |
<system.web> | |
<httpHandlers> | |
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/> | |
</httpHandlers> | |
<!-- | |
Enabling request validation in view pages would cause validation to occur |
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 interface IMapper<TInput, TOutput> | |
{ | |
TOutput Map(TInput input); | |
} | |
public interface ICompositeMapper<TInput, TOutput> | |
{ | |
TOutput[] Map(TInput input); | |
} |
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.Linq; | |
using System.Text; | |
using NUnit.Framework; | |
using NSubstitute; | |
using Moq; | |
namespace NewTools | |
{ |
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
{ | |
"shell": true, | |
"working_dir": "${project_path:${folder}}", | |
"cmd": ["%WINDIR%\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild", "${project_base_name}.sln"] | |
} |
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
[user] | |
name = alexander.beletsky | |
email = alexander.beletsky@gmail.com | |
[alias] | |
lg = log --all --graph --pretty=format:'%C(bold blue)<%an>%Creset %Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci)%Creset' --abbrev-commit | |
[merge] | |
tool = p4merge | |
[diff] | |
tool = p4diff |
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
import urllib2 | |
def web_request(url): | |
response = urllib2.urlopen(url) | |
return response.read() | |
def get_next_link(page): | |
href = '<a href="'; | |
start_pos = page.find(href) | |
if start_pos > 0: |
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
import urllib2 | |
def get_html_body(html): | |
openTag = '<body>' | |
closeTag = '</body>' | |
bodyBegins = html.find(openTag) + len(openTag) | |
bodyEnds = html.find(closeTag, bodyBegins) | |
return html[bodyBegins:bodyEnds] |