Skip to content

Instantly share code, notes, and snippets.

View garpunkal's full-sized avatar
:octocat:

Gareth Wright garpunkal

:octocat:
View GitHub Profile
@garpunkal
garpunkal / umbraco8cleanup.sql
Last active October 9, 2023 08:04
Umbraco 8 clean-up scripts
PRINT '=============================================='
PRINT 'CLEARING LOG AND AUDIT TABLES'
PRINT '=============================================='
GO
PRINT '=============================================='
PRINT 'TRUNCATE TABLE umbracoLog'
PRINT '=============================================='
GO
@garpunkal
garpunkal / reddit.js
Last active December 25, 2022 09:47
Unhide all reddit hidden posts
setInterval(function() { window.scrollTo(0, document.body.scrollHeight); Array.from(document.querySelectorAll('button span'))
.filter(el => el.textContent === 'unhide').forEach(el=>el.click()); }, 1000);
@garpunkal
garpunkal / usync.json
Created June 23, 2022 13:51
usync config
"uSync": {
"ForceFips": true,
"Settings": {
"RootFolder": "uSync/v9/",
"DefaultSet": "Default",
"ImportAtStartup": "None",
"ExportAtStartup": "None",
"ExportOnSave": "All",
"UiEnabledGroups": "All",
"ReportDebug": false,
using System;
using Hangfire;
using Hangfire.Console;
using Hangfire.SqlServer;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Web.BackOffice.Authorization;
@garpunkal
garpunkal / delete members and vendrorders.sql
Last active February 9, 2021 14:17
delete members and vendrorders
truncate table [dbo].[cmsMember2MemberGroup]
delete from [dbo].[cmsmember]
delete from [dbo].[vendrOrderAppliedDiscount]
delete from [dbo].[vendrOrderAppliedDiscountCode]
delete from [dbo].[vendrOrderAppliedGiftCard]
delete from [dbo].[vendrorderlineproperty]
delete from [dbo].[vendrorderline]
delete from [dbo].[vendrFrozenPrice]
delete from [dbo].[vendrOrderProperty]
delete from [dbo].[vendrorder]
@garpunkal
garpunkal / umbraco.css
Created June 5, 2020 11:42
Umbraco Grid CSS - Vertical stacked icons
#umb-grid .umb-card-grid.-four-in-row,
#umb-grid .umb-card-grid.-three-in-row {
flex-flow: column wrap;
}
#umb-grid .umb-card-grid.-four-in-row .umb-card-grid-item,
#umb-grid .umb-card-grid.-three-in-row .umb-card-grid-item {
padding-top: 12%;
}
public static class PagingExtensions
{
public static IEnumerable<T> Page<T>(this IEnumerable<T> list, int pageSize, int page)
{
return list.Skip((page - 1) * pageSize).Take(pageSize);
}
public static IQueryable<T> Page<T>(this IQueryable<T> list, int pageSize, int page)
{
return list.Skip((page - 1) * pageSize).Take(pageSize);
}
@garpunkal
garpunkal / Pager.cs
Created January 21, 2020 15:17
DisplayTemplate for MvcPaging
@model PaginationModel
@if (Model == null || Model.PageCount <= 1) { return; }
<ul class="pagination">
@foreach (var link in Model.PaginationLinks)
{
@BuildLink(link)
}
</ul>
@garpunkal
garpunkal / LastChanceContentFinder.cs
Created January 21, 2020 13:24
LastChanceContentFinder with global
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Web;
using Umbraco.Web.Routing;
namespace Business.ContentFinders
{
public class LastChanceContentFinder : IContentFinder
{
@garpunkal
garpunkal / LastChanceContentFinder.cs
Last active January 21, 2020 13:15
LastChanceContentFinder.cs
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Web;
using Umbraco.Web.PublishedContentModels;
using Umbraco.Web.Routing;
namespace Web.ContentFinders
{
public class LastChanceContentFinder : IContentFinder