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
--- | |
--- | |
[ | |
{% for post in site.posts %} | |
{ "title": "{{ post.title }}", "url": "{{ post.url}}" }, | |
{% endfor %} | |
null | |
] |
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 static class EqualityExtender | |
{ | |
/// <summary> | |
/// Sometimes you want to say this.Name = "Bob" or "Fran". Linq lets you do: | |
/// new[]{"Fran", "Bob"}.Any(n=> n == this.Name); | |
/// | |
/// but isn't it nicer to do: | |
/// | |
/// this.Name.EqualsAnyOf(new[]{"Bob", "Fran"}); | |
/// </summary> |
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; | |
namespace EntityExtensions { | |
public class FakeDbSet<T> : System.Data.Entity.IDbSet<T> where T : class { | |
private readonly List<T> list = new List<T>(); | |
public FakeDbSet() { |
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 static class ControllerHelper { | |
// working with forms on MVC 3, I found a handful of instances where I wanted to support ajax form submits using the jQuery form plugin | |
// but still wanted to keep the option of graceful degradation if javascript wasn't supported. | |
// there might be a better approach to this, like having seperate Ajax and vanilla Post methods, | |
// moving the logic that currently resides in the controller elsewhere. That would increase complexity a lot all at once. | |
// Perhaps this kind of thing is the right path in the short term. | |
public static ActionResult PartialIfAjax_ViewOtherwise(this Controller controller, string viewName, object model) { | |
if (controller.Request.IsAjaxRequest()) { | |
return controller.PartialView(viewName, model); |
NewerOlder