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 HandleRecordNotFoundAttribute : ActionFilterAttribute | |
{ | |
public override void OnResultExecuting(ResultExecutingContext filterContext) | |
{ | |
var viewResult = filterContext.Result as ViewResult; | |
if (viewResult != null && viewResult.ViewData.Model == null) | |
{ | |
filterContext.Result = new ResourceNotFoundResult(); | |
filterContext.Result.ExecuteResult(filterContext.Controller.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
map.connect '/somethin/:email', requirements => { :email => / <insert your favorite email regex here> / } |
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
"{\"issue\":[{\"@priority\":\"1\",\"@type\":\"Task\",\"@state\":\"Fixed\",\"@subsystem\":\"No subsystem\",\"@id\":\"DCVR-1\",\"@fixedVersion\":\"\",\"@projectShortName\":\"DCVR\",\"@reporterName\":\"ruslan.isakiev\",\"@fixedInBuild\":\"Next build\",\"@commentsCount\":\"0\",\"@numberInProject\":\"1\",\"@summary\":\"Show coverage results in unit test runner's window\",\"@created\":\"1256724558540\",\"@updated\":\"1257780483529\",\"@historyUpdated\":\"1257780483532\",\"@resolved\":\"1257769772458\",\"@votes\":\"0\",\"links\":null,\"attachments\":null},{\"@priority\":\"1\",\"@type\":\"Exception\",\"@state\":\"Fixed\",\"@subsystem\":\"Submitted exceptions\",\"@id\":\"DCVR-2\",\"@fixedVersion\":\"\",\"@projectShortName\":\"DCVR\",\"@reporterName\":\"ruslan.isakiev\",\"@fixedInBuild\":\"Next build\",\"@commentsCount\":\"0\",\"@numberInProject\":\"2\",\"@summary\":\"Exception : An exception has occurred during action 'OpenSnapshot' execution. Sample exception\",\"@description\":\"dotCover 1.0 Version=1.0.0.0, Built=2 |
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
{"issue":[{"@priority":"1","@type":"Task","@state":"Fixed","@subsystem":"No subsystem","@id":"DCVR-1","@fixedVersion":"","@projectShortName":"DCVR","@reporterName":"ruslan.isakiev","@fixedInBuild":"Next build","@commentsCount":"0","@numberInProject":"1","@summary":"Show coverage results in unit test runner's window","@created":"1256724558540","@updated":"1257780483529","@historyUpdated":"1257780483532","@resolved":"1257769772458","@votes":"0","links":null,"attachments":null},{"@priority":"1","@type":"Exception","@state":"Fixed","@subsystem":"Submitted exceptions","@id":"DCVR-2","@fixedVersion":"","@projectShortName":"DCVR","@reporterName":"ruslan.isakiev","@fixedInBuild":"Next build","@commentsCount":"0","@numberInProject":"2","@summary":"Exception : An exception has occurred during action 'OpenSnapshot' execution. Sample exception","@description":"dotCover 1.0 Version=1.0.0.0, Built=2009-11-02T12:21:25, Configuration=“Full PublicMode VS0900”\nAn exception has occurred during action 'OpenSnapshot' execution. |
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 AutoFilterActionInvoker: ControllerActionInvoker | |
{ | |
protected override FilterInfo GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor) | |
{ | |
var filters = base.GetFilters(controllerContext, actionDescriptor); | |
filters.ResultFilters.Add(new CustomBehaviorAttribute()); | |
return filters; | |
} |
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
_routeConventions.MapAction("Create").WithNoParameters().ToCustomUrl("/new").ConstraintToVerb(HttpVerbs.Get); |
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
[Subject("Encoding Enums")] | |
public class when_encoding_an_object_that_contains_an_enum | |
{ | |
Establish context = () => | |
{ | |
IEnumerable<IDataReader> readers = new List<IDataReader> { new JsonReader(new DataReaderSettings(), "application/.*json") }; | |
IEnumerable<IDataWriter> writers = new List<IDataWriter> { new JsonWriter(new DataWriterSettings(), "application/.*json") }; | |
codec = new DefaultCodec(new RegExBasedDataReaderProvider(readers), new RegExBasedDataWriterProvider(writers)); |
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 a_response_that_contains_umlats | |
{ | |
Because of = () => | |
{ | |
var http = new HttpClient(); | |
http.Request.Accept = HttpContentTypes.ApplicationJson; | |
response = http.Get("https://api.github.com/users/thecodejunkie"); |
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
describe('Farting', function () { | |
describe('when shaking the phone with my hands', function () { | |
it('a farting sound should appear', function (done) { | |
// TODO: Implement Fart | |
done(); | |
}); | |
}); |
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 logger(options) { | |
if ('object' == typeof options) { | |
options = options || {}; | |
} else if (options) { | |
options = { format: options }; | |
} else { | |
options = {}; | |
} |
OlderNewer