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
// Use | |
var parser = new HttpRequestToTextParser(); | |
var res = parser.Parse(Request); | |
System.IO.File.AppendAllLines(@"c:\\temp\\log_request.txt",res); | |
// Implementation | |
public class HttpRequestToTextParser | |
{ | |
public List<string> Parse(HttpRequestBase request) | |
{ |
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
// ******* Confirmation-dialog ********** | |
var overlay = { | |
"view": "default", | |
"title": 'Headline', | |
"content": 'This is some important text that you need to confirm', | |
"disableBackdropClick": true, | |
"disableEscKey": true, | |
"submitButtonLabel": 'Confirm', | |
"closeButtonLabel": 'Cancel', |
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 index = (LuceneIndex)ExamineManager.Instance.Indexes.Where(f => f.Name == "ExternalIndex").FirstOrDefault(); | |
// Get the IndexWriter | |
var writer = index.GetIndexWriter(); | |
var searcher = (BaseLuceneSearcher)index.GetSearcher(); | |
// perform search to get the doc from the index based on node id | |
Term term = new Term("id", "1082"); // Term to get node by id | |
var q = new TermQuery(term); |
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.Linq; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
using System.Text.RegularExpressions; | |
using Moq; | |
using Umbraco.Core.Models; | |
using Umbraco.ModelsBuilder; | |
namespace Obviuse.Tests |
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
/// <summary> | |
/// Just used to record an incomming request to see any headers passed from CloudFront to the Win2012-server. | |
/// Routes to: /umbraco/surface/contactmesurface/recordrequest | |
/// </summary> | |
/// <returns></returns> | |
public ActionResult RecordRequest() | |
{ | |
var path = Server.MapPath("~/app_data/logs/") + DateTime.Now.ToString("yyyyMMdd-hhmmss_") + ".txt"; |
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 class UmbracoHelperExtensions | |
{ | |
public static IEnumerable<IPublishedContent> TypedContentByPropertyValue(this UmbracoHelper helper, string propertyName, string value, string documentTypeAlias = "") | |
{ | |
if (string.IsNullOrEmpty(documentTypeAlias)) | |
documentTypeAlias = "*"; | |
// format: var all = Umbraco.TypedContentAtXPath("//jobListing[englishUrlName = 'test']"); | |
return helper.TypedContentAtXPath($"//{documentTypeAlias}[{propertyName} = '{value}']"); | |
} |
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
/* | |
2018-12-06 | |
This SQL will remove all content and media that's in the recycle bin | |
Tested on: Umbraco 7.12.3 | |
NOTE: | |
You might want to empty the recycle bin in the media-section manually since the files on disk will not be deleted when executing this SQL-query. | |
PRO-TIP: Execute each line one by one by selecting the row and hit CTRL+E | |
*/ |
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
CREATE FUNCTION [dbo].[mntpConvert] | |
( | |
-- Add the parameters for the function here | |
@mntpXml ntext | |
) | |
RETURNS nvarchar(MAX) | |
AS | |
BEGIN | |
-- Declare the return variable here | |
DECLARE @Result nvarchar(MAX) |
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.Threading.Tasks; | |
using System.Web; | |
using Umbraco.Core; | |
using Umbraco.Core.Logging; | |
using Umbraco.Web.Routing; |
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
-- set how many versions to keep using @numberOfVersionToKeep, this can be set to anything from 0 and above. 0 will clean all versions except the current of course. | |
-- actually delete stuff by modifying last line to 'commit tran' | |
begin tran | |
go | |
DECLARE @numberOfVersionToKeep int = 20 | |
IF OBJECT_ID('tempdb..#tmp') IS NOT NULL DROP Table #tmp | |
create table #tmp (versionid uniqueidentifier) |
NewerOlder