Skip to content

Instantly share code, notes, and snippets.

@sihugh
sihugh / benchmark.cs
Created October 12, 2012 14:55
Code to profile a method - allows for easy comparison between two similar approaches
using System;
using System.Diagnostics;
namespace Benchmark
{
/// <summary>
/// This code has been adapted from the question at http://stackoverflow.com/questions/1047218/benchmarking-small-code-samples-in-c-can-this-implementation-be-improved
/// </summary>
class Program
{
@sihugh
sihugh / TracingControlAdapter.cs
Created October 12, 2012 20:09
Traces WebControl lifecycle to provide timings in the Asp.NET tracing output
using System;
using System.Web.UI.Adapters;
namespace SH.ControlAdapters
{
/// <summary>
/// When used with ASP.NET tracing provides a way of tracking performance of WebControls.
/// </summary>
public class TracingControlAdapter : ControlAdapter
{
@sihugh
sihugh / moss-simple-broken1.css
Created November 20, 2012 21:38
MOSS simple theme - broken links 1
.ms-topnavselected {
color:#003399;
background:url("http://localhost/topnavselected_simple.gif");
background-repeat:repeat-x;
border:solid 1px #bfbfbf;
border-bottom-width:0px;
border-left:solid 1px #fff;
background-color:#d1d1d1;
}
@sihugh
sihugh / moss-verdant-broken-1.css
Created November 20, 2012 22:11
MOSS verdant theme - broken links 1
.ms-globalTitleArea{
background-image:url("siteTitleBKGD_vintage.jpg");
}
.ms-globalTitleAreaSeparator{
background-image:url("siteTitleBKGD_vintage.jpg");
}
@sihugh
sihugh / moss-belltown-invalid.css
Last active December 16, 2015 03:38
An example of invalid CSS in MOSS "Belltown" theme. It's pretty widespread in SharePoint themes in general
.ms-PostFooter{
color:#2d7f75;
1px solid #a9c6c3; //Missing property on line 3
}
@sihugh
sihugh / themesFromLogs.bat
Created April 12, 2013 13:13
Log parser statement to retrieve MOSS themes requests from an IIS log file
logparser "SELECT * from <path to logs)\*.log WHERE cs-uri-stem LIKE '%/\_themes%'"
<configuration>
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
</configuration>
$appPoolName = $args[0]
$appPool = get-wmiobject -namespace "root\MicrosoftIISv2" -class "IIsApplicationPool" | Where-Object {$_.Name -eq "W3SVC/APPPOOLS/$appPoolName"}
$appPool.Recycle()
@sihugh
sihugh / ItemVersionReader
Created September 23, 2014 10:30
A utility class for helping determine if a SharePoint item update event is a result of a publish, approve or just an update.
/// <summary>
/// Use in "Updating" event handler to determine if an update is a publish event.
/// </summary>
public class ItemVersionReader
{
public Version BeforeVersion { get; private set; }
public int PublishingLevel { get; private set; }
public int ModerationStatus { get; private set; }
public bool IsPublishing
{
source 'https://rubygems.org'
gem 'github-pages'
gem 'html-proofer'