Skip to content

Instantly share code, notes, and snippets.

@sniffdk
sniffdk / checksize
Last active February 22, 2018 08:19 — forked from anonymous/gist:1391040
declare @RowCount int, @tablename varchar(100)
declare @Tables table (
PK int IDENTITY(1,1),
tablename varchar(100),
processed bit
)
INSERT into @Tables (tablename)
SELECT TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_TYPE = 'BASE TABLE' and TABLE_NAME not like 'dt%' order by TABLE_NAME asc
declare @Space table (
name varchar(100), rows nvarchar(100), reserved varchar(100), data varchar(100), index_size varchar(100), unused varchar(100)
@sniffdk
sniffdk / A custom Umbraco controller implementation
Last active December 20, 2015 12:59 — forked from mattbrailsford/ListingController.cs
A slightly modified version of custom controllers/views. Works perfectly on my machine :)
public class Global : UmbracoApplication
{
protected override void OnApplicationStarting(object sender, EventArgs e)
{
base.OnApplicationStarting(sender, e);
DefaultRenderMvcControllerResolver.Current.SetDefaultControllerType(typeof(ListingPageController));
}
}
@sniffdk
sniffdk / Testimonials.cs
Last active December 12, 2015 04:58 — forked from mattbrailsford/Testimonials.cs
Searching for nodes in the new Umbraco v6 API via Examine
// It's properly more correct to search on NodeTypeAlias (or DocumentTypeAlias as it's called in the new API)
var criteria = ExamineManager.Instance.DefaultSearchProvider.CreateSearchCriteria().NodeTypeAlias("Testimonial").Compile();
var testimonials = Model.Content.AncestorOrSelf(1)
.Sibling("Repository")
.Search(criteria);
// Or perhaps even just this, no traversing is need, performance should be the same, as nodes in Lucene aren't hierarchically stored
var criteria = ExamineManager.Instance.DefaultSearchProvider.CreateSearchCriteria().NodeTypeAlias("Testimonial").Compile();
var testimonials = Model.Content.Search(criteria);