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
var editors = { | |
Markdown: { | |
name: "Markdown", | |
select: function() { | |
$("'.editor").addClass("editor-md"); | |
$("#wmd-button-bar").show(); | |
this.init(); | |
}, | |
init: function () { | |
if ($(".editor-md").length > 0 && !$(".editor-md").data(this.name)) { |
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 MyController { | |
private readonly IViewFactory viewFactory; | |
private readonly ICommandBus bus; | |
public MyController(IViewFactory viewFactory, ICommandBus bus) { | |
this.viewFactory = viewFactory; | |
this.bus = bus; |
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 IWidget | |
{ | |
string Title { get; } | |
IHtmlString Render(HtmlHelper htmlHelper); | |
} | |
public class LatestTweetsWidget : IWidget | |
{ | |
public string Title { get { return "Latest Tweets"; } } | |
public string Handle { get; set; } |
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
namespace Fabrik.Common.Web | |
{ | |
public interface IViewBuilder<TView> | |
{ | |
TView Build(); | |
} | |
public interface IViewBuilder<TInput, TView> | |
{ | |
TView Build(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
body { | |
font-size: .85em; | |
font-family: "Trebuchet MS", Verdana, Helvetica, Sans-Serif; | |
margin: 0; | |
padding: 0; | |
color: #696969; | |
background: url(data:image/jpg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAA9AAD/4QNtaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjAtYzA2MCA2MS4xMzQ3NzcsIDIwMTAvMDIvMTItMTc6MzI6MDAgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6QTdDM0IxNjQyOEJGRTExMTkwMzA4NUUwMkVFMTQzMDMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NDYyRThDOEZCRjMxMTFFMUJEM0NFODZCQTUyOUNEMDMiIHhtcE1NOkluc3Rhb |
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 StructureMapFilterProvider : IFilterProvider | |
{ | |
private readonly IContainer container; | |
public StructureMapFilterProvider(IContainer container) | |
{ | |
this.container = container; | |
} | |
public IEnumerable<FilterInfo> GetFilters(HttpConfiguration configuration, HttpActionDescriptor actionDescriptor) |
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
static Dictionary<int, string> etags = new Dictionary<int, string>(); | |
// GET api/site/5 | |
public HttpResponseMessage Get(int id, HttpRequestMessage request) | |
{ | |
var etag = request.Headers.IfNoneMatch; // strange that we can't do FirstOrDefault() | |
if (etag != null && etags.ContainsKey(id)) | |
{ | |
if (etags[id] == etag.ToString()) |
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 ValidateModelStateAttribute : ActionFilterAttribute | |
{ | |
public override void OnActionExecuting(HttpActionContext actionContext) | |
{ | |
if (!actionContext.ModelState.IsValid) | |
{ | |
var errors = from k in actionContext.ModelState.Keys | |
from e in actionContext.ModelState[k].Errors | |
select new ValidationError { ParameterName = k, ErrorMessage = e.ErrorMessage }; |
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
[TestFixture] | |
public class OliverTest : RavenTest | |
{ | |
public class OnlineStoreSection | |
{ | |
public string Id { get; set; } | |
public TargetAudience TargetAudience { get; set; } | |
public IEnumerable<string> Tags { get; set; } | |
} |
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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Type q to Quit"); | |
string input; | |
while ((input = Console.ReadLine()) != "q") | |
{ | |
var sw = new Stopwatch(); |