Skip to content

Instantly share code, notes, and snippets.

View ProNotion's full-sized avatar

ProNotion

  • Prolific Notion Ltd
  • Plymouth, UK
View GitHub Profile
@ProNotion
ProNotion / ModelsBuilderHelpers.cs
Last active November 10, 2023 14:07
Helper Method to get Umbraco ModelsBuilder Model Property Aliases
internal static string GetModelPropertyTypeAlias<TModel>(Expression<Func<TModel, object>> selector)
where TModel : PublishedElementModel
{
Expression body = selector.Body;
// Unwrap conversions, if any
if (body is UnaryExpression unaryExpression && unaryExpression.NodeType == ExpressionType.Convert)
body = unaryExpression.Operand;
if (!(body is MemberExpression memberExpression))
@ProNotion
ProNotion / umbracoMembersWithLoginDate.sql
Last active June 27, 2023 08:33
Get Umbraco Members with last login date
SELECT m.LoginName, m.Email, cmsPropertyData.dataDate AS LastLoginDate
FROM cmsPropertyType INNER JOIN
cmsPropertyData ON
cmsPropertyType.id = cmsPropertyData.propertytypeid RIGHT OUTER JOIN
cmsMember AS m ON cmsPropertyData.contentNodeId = m.nodeId
WHERE (cmsPropertyType.Alias = N'umbracoMemberLastLogin') AND (cmsPropertyData.dataDate IS NOT NULL)
ORDER BY LastLoginDate DESC
######## Phil's dev VM boxstarter script ########
###############
#### NOTES ####
###############
## After a restart/reconnect, even though it shows the login screen, boxstarter is still working
### NOTES when kicking off remotely from host to VM, fails on Configuring CredSSP settings
## check http://blogs.technet.com/b/heyscriptingguy/archive/2012/12/30/understanding-powershell-remote-management.aspx
@ProNotion
ProNotion / MigrateUmbracoRedirectsToUrlTracker
Last active June 15, 2018 09:53
Migrates records from the umbracoRedirectUrl table to the icUrlTracker table
INSERT INTO [icUrlTracker] (OldUrl, RedirectNodeId, Notes)
SELECT
RIGHT(url, LEN(url) - 1),
(SELECT TOP (1)
id
FROM umbracoNode
WHERE (uniqueID = umbracoRedirectUrl.contentKey))
AS NodeId,
'Import from umbracoRedirectUrl table' AS Note
FROM umbracoRedirectUrl
@ProNotion
ProNotion / gist:878fe157ff9ff025742ca6776c0fce48
Created June 15, 2018 09:23
Adds ForceRedirect column to UrlTracker table
ALTER TABLE icUrlTracker ADD ForceRedirect BIT DEFAULT 0 NOT NULL
@ProNotion
ProNotion / IIS_Sites_With_SSL.ps1
Created February 13, 2018 09:04
List all sites in IIS with SSL Bindings
import-module WebAdministration
Write-Host "`n Listing sites with SSL bindings"
Write-Host "**********************************`n"
ls IIS:\SslBindings | Foreach {
Write-Host " - $($_.Host)"
}
Write-Host "`n**********************************"
@ProNotion
ProNotion / Purge Long Folder Structures
Last active May 12, 2016 18:07
How to Delete Files which exceed 255 Characters on Windows e.g. long filenames
robocopy /PURGE <empty_dir> <directory_to_remove>
@ProNotion
ProNotion / gist:a2c3fdd29ab63b737f10776394978140
Created May 12, 2016 12:25
How to Delete Files which exceed 255 Characters on Windows e.g. long filenames
robocopy /PURGE <empty_dir> <directory_to_remove>
@ProNotion
ProNotion / gist:e8bd06769af087d7412fd015489312ad
Created May 12, 2016 12:25
How to Delete Files which exceed 255 Characters on Windows e.g. long filenames
robocopy /PURGE <empty_dir> <directory_to_remove>
@ProNotion
ProNotion / ISO3166-Country-List-Table.sq
Created January 21, 2016 12:01
TSQL ISO3166 Country List Table
PRINT 'Checking for existence of table ''countries'''
/****** Object: Table [dbo].[Countries] Script Date: 11/09/2006 16:58:01 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Countries]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Countries]
PRINT 'Existing table ''countries'' dropped!'
GO
/****** Object: Table [dbo].[Countries] Script Date: 11/09/2006 16:58:01 ******/