Skip to content

Instantly share code, notes, and snippets.

View strippedsharpgist's full-sized avatar

strippedsharpgist

View GitHub Profile
@aaronpowell
aaronpowell / gist:d798507cbca08d86b41a
Created April 30, 2014 05:13
Find csproj files referencing an assembly
Get-ChildItem -Filter *.csproj -Recurse |
Select-Object -Property FullName,@{N="Xml"; E = {
Select-Xml -Path $_.FullName -XPath //b:Reference -Namespace @{b='http://schemas.microsoft.com/developer/msbuild/2003'} |
Select-Object -ExpandProperty Node |
Select-Object -Property Include, HintPath |
Where-Object { $_.HintPath -ne $null } |
Where-Object { $_.Include -eq "My.Assembly.Name" }
} } |
Where-Object { $_.Xml -ne $null } |
Out-GridView
@karlitros
karlitros / UmbracoSitemapProviderReference.xml
Last active August 29, 2015 14:00
Comment this bit out of an umbraco web.config file when you want publishing times to improve when publishing large amounts of content
<siteMap defaultProvider="UmbracoSiteMapProvider" enabled="true">
<providers>
<clear />
<add name="UmbracoSiteMapProvider" type="umbraco.presentation.nodeFactory.UmbracoSiteMapProvider" defaultDescriptionAlias="description" securityTrimmingEnabled="true" />
</providers>
</siteMap>
@csharpforevermore
csharpforevermore / AuthoHotKeyList.txt
Created April 27, 2014 15:50
AutoHotKey Key List
Key Name Resulting Keystroke
{F1} - {F24} Function keys. For example: {F12} is the F12 key.
{!} !
{#} #
{+} +
{^} ^
{{} {
{}} }
{Enter} ENTER key on the main keyboard
{Escape} or {Esc} ESCAPE
@tomfulton
tomfulton / gist:11007948
Last active December 31, 2017 23:09
BoxStarter Script
Update-ExecutionPolicy Unrestricted
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Disable-UAC
Disable-InternetExplorerESC
cinst TelnetClient -source windowsFeatures
cinst IIS-WebServerRole -source windowsFeatures
cinst UrlRewrite
cinst msdeploy3
@sniffdk
sniffdk / PageNotFoundContentFinder.cs
Created February 10, 2014 12:07
PageNotFoundContentFinder
public bool TryFindContent(PublishedContentRequest contentRequest)
{
if (contentRequest.Is404)
{
var site = SiteHelpers.GetSite();
var page404 = site.Get404Page();
if (page404 != null)
{
contentRequest.PublishedContent = contentRequest.RoutingContext.UmbracoContext.ContentCache.GetById(page404.Id);
@sniffdk
sniffdk / ContextHelpers.cs
Last active February 28, 2022 10:03
Fake an UmbracoContext for use when doing published scheduling or other scenarios where UmbracoContext is normally null.
public class ContextHelpers
{
public static UmbracoContext EnsureUmbracoContext() {
if (UmbracoContext.Current != null)
{
return UmbracoContext.Current;
}
var httpContext = new HttpContextWrapper(HttpContext.Current ?? new HttpContext(new SimpleWorkerRequest("temp.aspx", "", new StringWriter())));
@perploug
perploug / gist:7334403
Last active October 11, 2016 12:57
how to hook into tree menus in V7
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Umbraco.Core;
namespace Meh.App_Code
{
public class ChangeMenu : ApplicationEventHandler
{
@dereke
dereke / InjectJavascriptIntoUmbracoAdminPage.cs
Last active December 16, 2015 13:29
Inject JavaScript into Umbraco Admin pages
public class Global : HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
umbracoPage.Load += InjectJavascript;
}
private void InjectJavascript(object sender, EventArgs eventArgs)
{
var page = sender as umbracoPage;
@dereke
dereke / DetectAndSaveUmbracoChanges.js
Last active December 16, 2015 13:29
Detect changes within an umbraco admin page (editContent.aspx) and save those changes using ajax. Inject the JavaScript into the page using the technique described here - https://gist.github.com/dereke/5442187
var formHasChanged = false;
var formEl = $('form');
formEl.on('change', function () {
formHasChanged = true;
});
var hasUnsavedChanges = function () {
for (var editorId in tinyMCE.editors) {
var editor = tinyMCE.editors[editorId];
@sitereactor
sitereactor / GoogleAnalyticsCacher.ashx.cs
Created May 4, 2012 18:42
Google Analytics data cacher used with Umbraco to cache stats to local json file
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using Google.GData.Analytics;
using Google.GData.Client;
using ServiceStack.Text;