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 string FormatBytes(long bytes, int scale = 1024) | |
{ | |
string[] orders = new string[] { "GB", "MB", "KB", "Bytes" }; | |
long max = (long)Math.Pow(scale, orders.Length - 1); | |
foreach (string order in orders) | |
{ | |
if (bytes > max) | |
{ | |
return String.Format("{0:##.##} {1}", Decimal.Divide(bytes, max), order); |
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.Web; | |
using System.Web.Caching; | |
using Umbraco.Core.Logging; | |
/// <summary> | |
/// Generic cache class | |
/// </summary> | |
/// <typeparam name="T">The type of the object to be cached</typeparam> | |
/// <remarks> |
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
select d.pk, lt.pk, d.[key], lt.languageId, l.languageISOCode, lt.value | |
from cmsDictionary d inner join cmsLanguageText lt on d.id = lt.UniqueId | |
left join umbracoLanguage l on lt.languageId = l.id | |
where d.pk = 6 |
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; | |
using System.Web; | |
using Umbraco.Core; | |
using Umbraco.Core.PropertyEditors; | |
using Umbraco.Core.Models; | |
using umbraco.editorControls; | |
using Umbraco.Web; |
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; | |
using System.Web; | |
using Umbraco.Core; | |
using Umbraco.Core.PropertyEditors; | |
using Umbraco.Core.Models; | |
using umbraco.editorControls; | |
using Umbraco.Web; |
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 joinedDoctypes = Umbraco.TypedContentAtXPath("//*[self::DocType1 or self::DocType2]") | |
// http://stackoverflow.com/questions/721928/xpath-to-select-multiple-tags |
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
2016-02-15 14:52:56,906 [P1364/D2/T1] INFO Umbraco.Core.CoreBootManager - Umbraco 7.4.0 application starting on DESKTOP-JJOR4ST | |
2016-02-15 14:52:56,927 [P1364/D2/T1] INFO Umbraco.Core.PluginManager - Determining hash of code files on disk | |
2016-02-15 14:52:56,934 [P1364/D2/T1] INFO Umbraco.Core.PluginManager - Hash determined (took 7ms) | |
2016-02-15 14:52:56,973 [P1364/D2/T1] INFO Umbraco.Core.PluginManager - Starting resolution types of umbraco.interfaces.IApplicationStartupHandler | |
2016-02-15 14:52:57,129 [P1364/D2/T1] INFO Umbraco.Core.PluginManager - Completed resolution of types of umbraco.interfaces.IApplicationStartupHandler, found 0 (took 156ms) | |
2016-02-15 14:52:57,138 [P1364/D2/T1] INFO Umbraco.Core.PluginManager - Starting resolution types of Umbraco.Core.PropertyEditors.IPropertyEditorValueConverter | |
2016-02-15 14:52:57,145 [P1364/D2/T1] INFO Umbraco.Core.PluginManager - Completed resolution of types of Umbraco.Core.PropertyEditors.IPropertyEditorValueConverter, found 0 (took 6ms) | |
2016-02 |
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 MyApplicationEvents : ApplicationEventHandler | |
{ | |
protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) | |
{ | |
ContentLastChanceFinderResolver.Current.SetFinder(new MyLastChanceContentFinder()); | |
} | |
} |
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
<?xml version="1.0"?> | |
<DateFolder DateFolderAlias="dateFolder"> | |
<DocumentType Alias="newsItem" DatePropertyAlias="postDate" /> | |
<!--<DocumentType Alias="PressReleaseItem" DatePropertyAlias="date" /> | |
<DocumentType Alias="EventItem" DatePropertyAlias="startDatetime" />--> | |
</DateFolder> |
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 CustomVersionProvider : IVersionProvider | |
{ | |
private Lazy<string> _productVersion = new Lazy<string>(() => | |
{ | |
var assembly = Assembly.GetExecutingAssembly(); | |
var assemblyVersion = assembly.GetName().Version; | |
var productVersion = string.Format("{0}.{1}.{2}", assemblyVersion.Major, assemblyVersion.Minor, assemblyVersion.Build); | |
// additional info | |
var dateFormat = "dd.MM.yyyyTHH:mm:ss"; | |
productVersion += string.Format(" (built: {0}) (LastWriteTime: {1})", |