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 FubuRegistry : Registry | |
{ | |
public FubuRegistry() | |
{ | |
var htmlConventionLibrary | |
= new HtmlConventionLibrary(); | |
var conventions | |
= new OverrideHtmlConventions(); | |
htmlConventionLibrary.Import(conventions.Library); | |
For<HtmlConventionLibrary>().Use(htmlConventionLibrary); |
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
using (var imageFactory = new ImageFactory()) | |
{ | |
var layer = new ResizeLayer(new Size(800, 500), null, ResizeMode.Stretch); | |
imageFactory.Load(ms) | |
.Resize(layer) | |
.Format(ImageFormat.Jpeg) | |
.Quality(90) | |
.Save(path); | |
} |
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 Impersonation : IDisposable | |
{ | |
public Impersonation(string username, string password, string domain) | |
{ | |
try | |
{ | |
IntPtr tokenHandle; // = IntPtr.Zero; | |
Int32 ret; | |
if ( |
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 MyViewEngine : RazorViewEngine | |
{ | |
/// <summary> | |
/// default ~/views | |
/// </summary> | |
/// <param name="startingPath"></param> | |
public MyViewEngine(string startingPath) | |
{ | |
var formats = new[] | |
{ |
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 GetContact : IQuery<Contact> | |
{ | |
public int Id {get;set;} | |
} | |
public class GetContactHandler : IQueryHandler<GetContact,Contact> | |
{ | |
public Contact Handle(GetContact request) | |
{ | |
return contact from db; |
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 struct DateTimeSpan | |
{ | |
private readonly int years; | |
private readonly int months; | |
private readonly int days; | |
private readonly int hours; | |
private readonly int minutes; | |
private readonly int seconds; | |
private readonly int milliseconds; |
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 ActionResult RemoveCategory(int id) | |
{ | |
var cat = _db.Get<Category>(id); | |
if(cat == null) | |
return HttpNotFound(); | |
... | |
} |
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 RemoveCategory : ICommand | |
{ | |
public Category Category {get;set;} | |
} | |
public class RemoveCategoryHandler : ICommandHandler | |
{ | |
public void Handle(RemoveCategory message) | |
{ | |
//remove category |
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 BigAssImpersonatingFileResult : FilePathResult | |
{ | |
public BigAssImpersonatingFileResult(string fileName, string contentType) | |
: base(fileName, contentType) | |
{ | |
} | |
protected override void WriteFile(HttpResponseBase response) | |
{ | |
using (new Impersonation()) |
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 CustomConvention : Convention | |
{ | |
public CustomConvention() | |
{ | |
Classes | |
.NameEndsWith("Tests"); | |
Methods | |
.Where(method => method.IsVoid()); |