Skip to content

Instantly share code, notes, and snippets.

View kipusoep's full-sized avatar

Stefan Kip kipusoep

View GitHub Profile
@kipusoep
kipusoep / Energieprijzen ophalen.lua
Last active February 16, 2023 21:34
Ophalen van EnergyZero energieprijzen voor Domoticz
-- Instructions --
-- Create the dummy hardware in Domoticz if you haven't already and from there,
-- create two 'Custom Sensor' devices with the axis labels 'EUR/kWh' and 'EUR/m³'.
-- Then set the following two device ids:
local powerDeviceIdx = 222
local gasDeviceIdx = 223
return {
on = {
/// <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)
{
--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 December 16, 2014 13:37
ImageProcessor auto-resize
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 February 26, 2024 17:08
SEO redirects for web.config
<!-- 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$" />