Skip to content

Instantly share code, notes, and snippets.

Avatar

Stefan Kip kipusoep

View GitHub Profile
View Replace odd and even occurrences.cs
/// <summary>
/// Replaces the <see cref="regexEscapedSearch" /> occurrences with <see cref="oddReplace" /> and <see cref="evenReplace"/>
/// </summary>
/// <param name="input">The input string</param>
/// <param name="regexEscapedSearch">The string to search for (escaped for usage in regex)</param>
/// <param name="oddReplace">To replace odd occurrences with</param>
/// <param name="evenReplace">To replace even occurrences with</param>
/// <returns></returns>
public static string ReplaceOddEvenOccurrences(this string input, string regexEscapedSearch, string oddReplace, string evenReplace)
{
View umbraco-clear-recycle-bin.sql
--deletes in Document
--at this point all associated media files are deleted
delete from umbracoDomains where id in (select id from umbracoNode where path like '%-20%' and id!=-20);
delete from cmsDocument where nodeId in (select id from umbracoNode where path like '%-20%' and id!=-20);
--deletes in Content
delete from cmsPropertyData where contentNodeId in (select id from umbracoNode where path like '%-20%' and id!=-20);
delete from cmsPreviewXml where nodeId in (select id from umbracoNode where path like '%-20%' and id!=-20);
delete from cmsContentVersion where ContentId in (select id from umbracoNode where path like '%-20%' and id!=-20);
delete from cmsContentXml where NodeId in (select id from umbracoNode where path like '%-20%' and id!=-20);
@kipusoep
kipusoep / gist:9fa2dc1160d21afaabc4
Created Dec 16, 2014
ImageProcessor auto-resize
View gist:9fa2dc1160d21afaabc4
MediaFileSystem mediaFileSystem = FileSystemProviderManager.Current.GetFileSystemProvider<MediaFileSystem>();
IContentSection contentSection = UmbracoConfig.For.UmbracoSettings().Content;
IEnumerable<string> supportedTypes = contentSection.ImageFileTypes.ToList();
foreach (IMedia media in e.SavedEntities)
{
if (media.HasProperty("umbracoFile"))
{
// Make sure it's an image.
string path = media.GetValue<string>("umbracoFile");
@kipusoep
kipusoep / web.config.xml
Last active Nov 21, 2020
SEO redirects for web.config
View web.config.xml
<!-- SEO rules (from: http://www.seomoz.org/blog/what-every-seo-should-know-about-iis#chaining) -->
<!-- SEO | Section 1 | Whitelist -->
<rule name="Whitelist - Resources" stopProcessing="true">
<match url="^(?:css/|scripts/|images/|install/|config/|umbraco/|umbraco_client/|base/|webresource\.axd|scriptresource\.axd|__browserLink|[^/]*/arterySignalR/.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="None" />
</rule>
<!-- SEO | Section 2 | Rewrites (chaining) -->
<rule name="SEO - Remove default.aspx" stopProcessing="false">
<match url="(.*?)/?default\.aspx$" />
You can’t perform that action at this time.