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.Globalization; | |
using System.Linq; | |
using System.Web; | |
using Umbraco.Core; | |
using Umbraco.Core.Models; | |
using Umbraco.Core.Strings; |
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
/// 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 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
// uses Newtonsoft Json | |
var slideshareOembedUrl = "http://www.slideshare.net/api/oembed/2?url=" + urlToRender + "&maxwidth=800&maxheight=400&format=json"; | |
var wc = new WebClient(); | |
var json = wc.DownloadString(slideshareOembedUrl); | |
var jsonObject = JObject.Parse(json); | |
return jsonObject.Property("thumbnail").Value.ToString(); |
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 FileSize | |
{ | |
public static string FormatBytes(string bytes, int scale = 1024) | |
{ | |
long bytesNumber = Convert.ToInt64(bytes); | |
return FormatBytes(bytesNumber, scale); | |
} | |
public static string FormatBytes(long bytes, int scale = 1024) |
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.Web; | |
using System.Web.Mvc; | |
using Umbraco.Web.Models; | |
using Umbraco.Web.Mvc; | |
namespace Controllers | |
{ | |
/// <summary> |
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.Collections.Generic; | |
using System.Web; | |
using Newtonsoft.Json; | |
/// <summary> | |
/// Captcha helper | |
/// </summary> | |
/// <remarks> | |
/// Original http://stackoverflow.com/questions/27764692/validating-recaptcha-2-no-captcha-recaptcha-in-asp-nets-server-side | |
/// </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
// Using old namespace to create Macro, since Umbraco.Core.Models.Macro is still an internal class in Umbraco V7.1.8 | |
var macro = new Macro.Macro { Alias = alias, Name = name, ScriptingFile = scriptingFile, UseInEditor = useInEditor, RenderContent = renderContent }; | |
macro.Save(); | |
var newMacro = Services.MacroService.GetByAlias(alias); | |
foreach (var macroProperty in macroProperties) | |
{ | |
newMacro.Properties.Add(macroProperty); | |
} | |
Services.MacroService.Save(newMacro); |
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
### Keybase proof | |
I hereby claim: | |
* I am dampee on github. | |
* I am damiaan (https://keybase.io/damiaan) on keybase. | |
* I have a public key whose fingerprint is 8916 1EB8 0874 7B83 C747 A50C 09B2 0515 7944 DF39 | |
To claim this, I am signing this object: |
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
[Test] | |
public void Delete_SortOrder_Is_Correct() | |
{ | |
// Arrange | |
var contentService = ServiceContext.ContentService; | |
var root = contentService.GetById(NodeDto.NodeIdSeed + 4); | |
var contentType = ServiceContext.ContentTypeService.GetContentType("umbTextpage"); | |
var contentList = CreateChildrenOf(contentType, root, 3); | |
contentService.Save(contentList); |
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.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