Skip to content

Instantly share code, notes, and snippets.

@Jeavon
Jeavon / gist:5421117
Created April 19, 2013 15:30
Adding SmtpAppender to log4net in Umbraco to email logs of Error or above
<?xml version="1.0"?>
<log4net>
<root>
<priority value="Info" />
<appender-ref ref="AsynchronousLog4NetAppender" />
<appender-ref ref="SmtpAppender"/>
</root>
<!--To Change the way logging works for certain namespaces, insert a new logger like: -->
<!--
<logger name="Umbraco.Core">
@Jeavon
Jeavon / gist:0bfa4c82a0dd43ff2c52
Created June 6, 2014 08:10
GetCropUrl - check for predefined and fall back if not
@{
if (feature.HasValue("Image"))
{
var featureImage = Umbraco.TypedMedia((int)feature.Image);
var myCropUrl = featureImage.GetCropUrl("PageBannerCrop") ?? featureImage.GetCropUrl(200, 100);
<a href="@feature.Url" class="image image-full"><img src="@myCropUrl" alt="" /></a>
}
}
@Jeavon
Jeavon / hgignore
Last active August 29, 2015 14:02
Umbraco7 hgignore
syntax: regexp
^packages/(?!repositories.config).*
# use glob syntax
syntax: glob
# Umbraco
wwwRoot/App_Data/umbraco.config
wwwRoot/App_Data/preview/*.config
wwwRoot/App_Data/TEMP/ClientDependency/
@Jeavon
Jeavon / gist:071f0fff4053cf8ad1e5
Created August 22, 2014 10:14
Set Slimmage Quality
window.slimmage = {verbose:true, jpegQuality:90, jpegRetinaQuality :80};
@Jeavon
Jeavon / AppIcons.cshtml
Last active November 8, 2016 12:31
AppIcons - Partial View for Umbraco
@using Umbraco.Web.Models
@inherits UmbracoViewPage<IPublishedContent>
@{
var internalMediaFolder = Umbraco.TypedMediaAtRoot().FirstOrDefault(x => x.DocumentTypeAlias == "InternalMediaFolder");
if (internalMediaFolder != null)
{
var appleTouchIcon = internalMediaFolder.Descendants().FirstOrDefault(x => x.DocumentTypeAlias == "AppleTouchIcon");
@Jeavon
Jeavon / web.config
Last active August 29, 2015 14:06
Exclude Umbraco from IIS compression to avoid View load failure
<location path="umbraco">
<system.webServer>
<urlCompression doStaticCompression="false" doDynamicCompression="false" dynamicCompressionBeforeCache="false" />
</system.webServer>
</location>
<location path="App_Plugins">
<system.webServer>
<urlCompression doStaticCompression="false" doDynamicCompression="false" dynamicCompressionBeforeCache="false" />
</system.webServer>
</location>
@Jeavon
Jeavon / Custom-2Col.css
Created September 10, 2014 16:15
Custom 2Col RTE Archetype Stylesheet
.archetypeEditor div.archetypeProperty {
float: left;
clear: none;
margin-left: 20px;
}
.archetypeEditor div.archetypeProperty:first-child {
margin-left: 0;
}
@Jeavon
Jeavon / RteCustomValueConverter.cs
Created September 30, 2014 09:41
Remove invalid rel tags from RTE images on render
namespace Crumpled.Logic.ValueConverters
{
using System.Linq;
using System.Web;
using HtmlAgilityPack;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.PropertyEditors.ValueConverters;
@Jeavon
Jeavon / gist:f50957baa96906a7e59c
Created October 30, 2014 20:00
Bind PVC by DataTypeId
public bool IsConverter(PublishedPropertyType propertyType)
{
return propertyType.DataTypeId == 1234;
}
@Jeavon
Jeavon / MyStuff.cs
Created October 31, 2014 18:36
Wrapper for GetCropUrl to set default bgColor
namespace MyStuff.App_Code
{
using Umbraco.Core.Models;
using Umbraco.Web;
public static class MyHelpers
{
public static string MyGetCropUrl(this IPublishedContent publishedContent, int width, int height)
{
var bgColor = "fff";