Skip to content

Instantly share code, notes, and snippets.

View simonproctor's full-sized avatar
🎩
What Ho!

Simon Proctor simonproctor

🎩
What Ho!
  • Code Miners Limited
View GitHub Profile
@simonproctor
simonproctor / Application
Created July 21, 2013 07:33
Delegate factory example for Autofac. Shows an ordinary factory and a factory returning owned instances.
namespace Demo
{
public class Application
{
private readonly IContainer container;
public Application()
{
ContainerBuilder builder = new ContainerBuilder();
builder.RegisterType<Biscuit>().As<IDependency>().Named<IDependency>("biscuits");
@simonproctor
simonproctor / ApiModule.cs
Created September 25, 2013 09:39
Sample Global.asax for a webforms project
// You could use a module to describe all the dependenices in some api dll and make
// it easier to load all components from that project.
public class ApiModule : Module
{
protected override void Load(ContainerBuilder builder)
{
builder.Register<UserManager>().As<IUserManager>();
builder.Register<QasAddressService>().As<IAddressSearchService>();
// Anything else required.
@simonproctor
simonproctor / Index recommendations
Last active August 29, 2015 14:04
Get index sizes in a db (basic)
-- With help from the internet and manning press!
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
select
ROUND(s.avg_total_user_cost * s.avg_user_impact * (s.user_seeks + s.user_scans),0) as Cost,
d.[statement] as TableName,
equality_columns,
inequality_columns,
included_columns
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "#428bca",
"@brand-success": "#5cb85c",