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 DateFormatService : IDateFormatService | |
{ | |
public virtual string FormatDate(DateTime dateTime, ContentTypeDate format, string language = "en") | |
{ | |
switch (format) | |
{ | |
case ContentTypeDate.PublishedDate: | |
return dateTime.ToString(DateFormats.FULL_DATE); | |
case ContentTypeDate.DateOfBirth: | |
return dateTime.ToString(DateFormats.FULL_DATE); |
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 CustomUmbracoSearchResultCoverter : DefaultUmbracoSearchResultCoverter, IUmbracoSearchResultCoverter | |
{ | |
public bool CanConvert(string contentAlias) | |
{ | |
return contentAlias == "nameOfDocType"; | |
} | |
public override string GetCategory(BaseUmbracoItem currentItem) | |
{ | |
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 PostSharp.Aspects; | |
using StackExchange.Profiling; | |
namespace xxx.Core.Logging | |
{ | |
[Serializable] | |
public sealed class MiniProfilerAttribute : MethodInterceptionAspect | |
{ | |
public override void OnInvoke(MethodInterceptionArgs context) |
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
{ | |
"wasSuccessfull" : "false" | |
fields: [ | |
{ | |
"name" : "firstName" | |
"label" : "First Name" | |
"value" : "Lee" | |
"required" : "true" | |
"validationMessage" : "This is required, douchebag" | |
"type" : "text" |
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.Web.Mvc; | |
namespace xx.Site.Infrastructure | |
{ | |
public class FormButtonAttribute : ActionMethodSelectorAttribute | |
{ | |
private readonly string _name; | |
public FormButtonAttribute(string 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
In Global.asax | |
protected override void OnApplicationStarting(object sender, EventArgs e) | |
{ | |
base.OnApplicationStarting(sender, e); | |
ObjectFactory.Configure( | |
x => x.For<ITest>().Use<Test>() | |
); | |
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
UmbracoService service = new UmbracoService(ApplicationContext.Services.ContentService, Context.Default); | |
service.GetItem<HomePage>(1); |
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
task Compile -depends Init, UpdateGlobalAssemblyInfo { | |
write-host "Solution: $solution_file" | |
write-host "Configuration: $build_configuration" | |
write-host "Target $build_target" | |
write-host "Verbosity: $build_verbosity" | |
write-host "Output directory: $build_dir" | |
exec { msbuild "$solution_file" /t:$build_target /p:configuration=$build_configuration /p:outdir="$build_dir" /verbosity:$build_verbosity /m /p:BuildInParallel=true /p:TrackFileAccess=false } | |
} |
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 ImageCompressionProcessor | |
{ | |
public void Process(GetMediaStreamPipelineArgs args) | |
{ | |
MediaStream outputStream = args.OutputStream; | |
if (outputStream == null) | |
return; | |
var bitmap = new Bitmap(Image.FromStream(outputStream.Stream)); |