Skip to content

Instantly share code, notes, and snippets.

View lars-erik's full-sized avatar

Lars-Erik Aabech lars-erik

View GitHub Profile
@lars-erik
lars-erik / fix-usync-forms.ps1
Last active February 28, 2024 11:23
uSync Migrate Forms from V8 to V13
param(
$path
)
$files = Get-ChildItem -Path $path -File
$files | % {
$fileInfo = $_
$doc = [xml](Get-Content $fileInfo.FullName)
$pageNode = $doc.DocumentElement.SelectSingleNode("Pages")
@lars-erik
lars-erik / Get-DocTypes-As-PlantUml.ps1
Created October 10, 2023 14:33
Umbraco Document Types to PlantUML
param (
$Server,
$Database,
$Direction = "left to right",
$IncludeDoctypes = $true,
[Switch]
$IncludeElements = $false,
[Switch]
$IncludeProperties = $false
)
@lars-erik
lars-erik / Set-AutoUpdateBehavior.ps1
Created November 19, 2022 13:58
Set steam AutoUpdateBehavior
# run in %programfiles%\Steam\steamapps
$files = Get-ChildItem -Path *.acf
$files | % {
$file = $_
$content = get-content $_
$content | % {
if ($_.Contains("AutoUpdateBehavior")) {
$_.Replace("0", "2")
@lars-erik
lars-erik / coalesce.m
Created July 11, 2022 08:49
Power Query Coalesce
let
Coalesce = (items as list) =>
let
listOfFirst = List.FirstN(List.Select(items, each _ <> "" and _ <> null), 1),
first = try List.Single(#"listOfFirst") otherwise null
in
first
in
Coalesce
@lars-erik
lars-erik / queries.m
Created September 8, 2021 07:24
Power Query for Umbraco Grid Data and DTGE
// umbracoPropertyData
let
Source = Sql.Database(".\sqlexpress", "[your database]"),
dbo_umbracoPropertyData = Source{[Schema="dbo",Item="umbracoPropertyData"]}[Data],
#"Expanded cmsPropertyType" = Table.ExpandRecordColumn(dbo_umbracoPropertyData, "cmsPropertyType", {"Alias", "Name", "umbracoDataType"}, {"cmsPropertyType.Alias", "cmsPropertyType.Name", "cmsPropertyType.umbracoDataType"}),
#"Expanded cmsPropertyType.umbracoDataType" = Table.ExpandRecordColumn(#"Expanded cmsPropertyType", "cmsPropertyType.umbracoDataType", {"propertyEditorAlias"}, {"cmsPropertyType.umbracoDataType.propertyEditorAlias"}),
#"Expanded umbracoContentVersion" = Table.ExpandRecordColumn(#"Expanded cmsPropertyType.umbracoDataType", "umbracoContentVersion", {"id", "current", "umbracoContent"}, {"umbracoContentVersion.id", "umbracoContentVersion.current", "umbracoContentVersion.umbracoContent"}),
#"Expanded umbracoLanguage" = Table.ExpandRecordColumn(#"Expanded umbracoContentVersion", "umbracoLanguage", {"languag
@lars-erik
lars-erik / list-all-sites.ps1
Created February 25, 2021 12:25
List all IIS sites (Win 2012 PS)
import-module webadministration
$sites = Get-ChildItem -path IIS:\Sites
$mappedSites = $sites | % {
$bindings = try { ($_.Bindings.Collection | % {$_.bindingInformation}) } catch { @() }
if ($bindings -eq $null) { $bindings = @() }
[PSCustomObject]@{ `
Name=$_.Name; `
Id=$_.Id; `
State=$_.State; `
Path=$_.PhysicalPath; `
@lars-erik
lars-erik / AllObjects.m
Last active September 10, 2021 13:49
Power Query data source function for HubSpot CRM V3 objects
let
Table.GenerateByPage = (getNextPage as function) as table =>
let
listOfPages = List.Generate(
() => getNextPage(null), // get the first page of data
(lastPage) => lastPage <> null, // stop when the function returns null
(lastPage) => getNextPage(lastPage) // pass the previous page to the next function call
),
// concatenate the pages together
tableOfPages = Table.FromList(listOfPages, Splitter.SplitByNothing(), {"Column1"}),
@lars-erik
lars-erik / FluidityEFRepository.cs
Created May 20, 2020 17:47
Using EF with Fluidity (for Umbraco)
using Fluidity;
using XYZ.Core.Entities;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Umbraco.Core.Models;
@lars-erik
lars-erik / PDF Indexer.cs
Created May 8, 2020 17:49
Old fashion free pdf indexing with Umbraco
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Xml.Linq;
using Examine;
using Examine.LuceneEngine.Providers;
using Lucene.Net.Analysis;
using Microsoft.WindowsAzure.Storage.Auth;
@lars-erik
lars-erik / PathIndexer.cs
Last active May 8, 2020 22:03
Umbraco path indexed properly. The only useful/interesting code here is really at the end of line 83. :)
using System.IO;
using Examine;
using Examine.LuceneEngine;
using Examine.LuceneEngine.Indexing;
using Lucene.Net.Analysis;
using Lucene.Net.Util;
using Umbraco.Core.Composing;
using Constants = Umbraco.Core.Constants;
// ReSharper disable once CheckNamespace