Skip to content

Instantly share code, notes, and snippets.

View neilgaietto's full-sized avatar
👁️‍🗨️

Neil Gaietto neilgaietto

👁️‍🗨️
View GitHub Profile
@neilgaietto
neilgaietto / Umbraco-Full-Cleanup.sql
Last active October 21, 2016 14:44 — forked from Hendy/DeleteAllVersions.sql
Umbraco - delete version history for all content
/* This script deletes:
* 1. Oprhan data
* 2. All nodes from the trash
* 3. All previous node versions which are not publish or not newest unpublished
*/
DECLARE @documentNodeObjectType uniqueidentifier = N'C66BA18E-EAF3-4CFF-8A22-41B16D66A972';
DECLARE @trashPath varchar(5) = '%-20%';
PRINT 'orphan data'
@neilgaietto
neilgaietto / ResetPasswordController.cs
Last active January 13, 2017 19:45
Simple Umbraco 7 Password Reset
[PluginController("PasswordReset")]
public class ResetPasswordController : Umbraco.Web.Mvc.SurfaceController
{
private MembershipProvider BackOfficeProvider
{
get
{
if (Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider] == null)
{
throw new InvalidOperationException("No membership provider found with name " +
@neilgaietto
neilgaietto / gist:62046966f29a5de024b0
Last active August 29, 2015 14:08
Create and Map within LINQ Select
var dtoItems = DataContext.Sources.Select(new Func<Source, SourceDTO>(s => {
var dto = new SourceDTO();
s.Map(dto);
return dto;
}));
@neilgaietto
neilgaietto / DebugTextWriter.cs
Last active December 22, 2015 00:39
Debug the queries running through your LINQ to SQL DataContext
public class DebugTextWriter : System.IO.TextWriter
{
public override void Write(char[] buffer, int index, int count)
{
//output queries to "Output" window in visual studio
System.Diagnostics.Debug.Write(new String(buffer, index, count), "DBDebug");
}
public override void Write(string value)
{
@neilgaietto
neilgaietto / gist:5084468
Created March 4, 2013 18:50
UpdatePanel - Completed Update - Javascript Event
//update panel callback
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args)
{
//update panel finished updating
}
@neilgaietto
neilgaietto / Global.asax
Created February 11, 2013 19:08
Get the reason why your ASP.NET application is shutting down.
void Application_End(object sender, EventArgs e)
{
var reason = System.Web.Hosting.HostingEnvironment.ShutdownReason;
}