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 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 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 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 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
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 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 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 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 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 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
var joinedDoctypes = Umbraco.TypedContentAtXPath("//*[self::DocType1 or self::DocType2]") | |
// http://stackoverflow.com/questions/721928/xpath-to-select-multiple-tags |
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 System; | |
using System.Collections.Generic; | |
using System.Globalization; | |
using System.Linq; | |
using System.Web; | |
using Umbraco.Core; | |
using Umbraco.Core.Models; | |
using Umbraco.Core.Strings; |
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
/// <summary> | |
/// Lorem Ipsum Generator | |
/// </summary> | |
/// <remarks> | |
/// Based on Javascript Version of Marcus Campbell - Version 2.0 (Copyright 2003 - 2005) | |
/// Open-source code under the GNU GPL: http://www.gnu.org/licenses/gpl.txt | |
/// </remarks> | |
/// <example> | |
/// LoremIpsumBuilder _lib = new LoremIpsumBuilder(); | |
/// string test = _lib.GetLetters(); |
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
/// ApplicationBase: prior to 4.8 | |
public class AdminUserPwdReset : ApplicationBase //: ApplicationStartupHandler | |
{ | |
public AdminUserPwdReset() | |
{ | |
var userTYpe = UserType.GetUserType(1); // admins | |
User adminUser = User.MakeNew("damiaan", "damiaan", hashPassword("default"), userTYpe); | |
adminUser.addApplication("users"); | |
adminUser.addApplication("settings"); | |
adminUser.addApplication("developer"); |
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 System; | |
using System.Globalization; | |
using System.Linq; | |
using umbraco.cms.businesslogic.web; | |
using Umbraco.Core; | |
using Umbraco.Web; | |
using Umbraco.Web.Routing; | |
/// <summary> | |
/// Summary description for NotFoundHandler |
OlderNewer