Skip to content

Instantly share code, notes, and snippets.

View nul800sebastiaan's full-sized avatar
🔥

Sebastiaan Janssen nul800sebastiaan

🔥
View GitHub Profile
CREATE TABLE [cmsPreviewXml](
[nodeId] [int] NOT NULL,
[versionId] [uniqueidentifier] NOT NULL,
[timestamp] [datetime] NOT NULL,
[xml] [ntext] NOT NULL,
CONSTRAINT [PK_cmsContentPreviewXml] PRIMARY KEY CLUSTERED
(
[nodeId] ASC,
[versionId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
@nul800sebastiaan
nul800sebastiaan / gist:77f789ffa8673a0f5ace4ce577e8b9aa
Created April 15, 2016 13:48
Run these in src\Umbraco.Web.UI.Client
npm install
npm install -g grunt-cli
npm install -g bower
grunt build --buildversion=7.4.3
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using Newtonsoft.Json;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Services;
using Umbraco.Web.HealthCheck;
public static Guid GetKey(this IPublishedContent content)
{
IPublishedContent um = content;
var wrapped = um as PublishedContentExtended;
while (wrapped != null)
wrapped = (um = wrapped.Unwrap()) as PublishedContentExtended;
var contentWithKey = um as IPublishedContentWithKey;
return contentWithKey == null ? Guid.Empty : contentWithKey.Key;
}
ALTER TABLE [dbo].[cmsPropertyTypeGroup] WITH CHECK ADD CONSTRAINT [FK_cmsPropertyTypeGroup_cmsPropertyTypeGroup_id] FOREIGN KEY([parentGroupId])
REFERENCES [dbo].[cmsPropertyTypeGroup] ([id])
GO
ALTER TABLE [dbo].[cmsPropertyTypeGroup] CHECK CONSTRAINT [FK_cmsPropertyTypeGroup_cmsPropertyTypeGroup_id]
GO
Import-Module -Name D:\Temp\ACME-posh\ACMEPowerShell.psd1
$domain = "mydomain.com"
$certificiatePassword = "abcd1234"
$email = "letsencrypt@mydomain.com"
$vault = "D:\Vault\{0}\{1}" -f $domain, [guid]::NewGuid()
mkdir $vault
cd $vault
Initialize-ACMEVault -BaseURI https://acme-v01.api.letsencrypt.org/
New-ACMERegistration -Contacts mailto:$email
@nul800sebastiaan
nul800sebastiaan / gist:b580faf76258a414df5a
Created July 28, 2015 08:51
Powershell: Remove first character of each file in directory
dir | Rename-Item -NewName { $_.Name.Substring(1, $_.Name.Length - 1) }
var contentService = UmbracoContext.Application.Services.ContentService;
var content = contentService.GetById(Model.Content.Id);
var currentValue = content.GetValue<bool>("myProp");
content.SetValue("myProp", !currentValue);
contentService.SaveAndPublishWithStatus(content);
@nul800sebastiaan
nul800sebastiaan / gist:ca61d2eccc3faa4f6ba5
Last active August 29, 2015 14:22
Update through ContentService
using System.Configuration;
using System.Web.Mvc;
using Umbraco.Web.Mvc;
using Umbraco.Web.UI.Umbraco.Controls;
namespace My.Controllers
{
public class MyUpdateController : SurfaceController
{
public ActionResult Create(SomeModel model)
@nul800sebastiaan
nul800sebastiaan / ShowOrderForm.cshtml
Last active July 15, 2019 01:05
ShowOrderForm.cshtml
@using Awesome.FormDemo.Controllers
@model Awesome.FormDemo.Models.TicketOrderModel
@if (TempData.ContainsKey("CustomMessage"))
{
<div>Hooray! - @TempData["CustomMessage"]</div>
}
else
{
using (Html.BeginUmbracoForm<TicketOrderController>("FormSubmit"))