Skip to content

Instantly share code, notes, and snippets.

Avatar
🎩
What Ho!

Simon Proctor simonproctor

🎩
What Ho!
  • Code Miners Limited
View GitHub Profile
@simonproctor
simonproctor / Application
Created Jul 21, 2013
Delegate factory example for Autofac. Shows an ordinary factory and a factory returning owned instances.
View Application
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 Sep 25, 2013
Sample Global.asax for a webforms project
View ApiModule.cs
// 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 Aug 29, 2015
Get index sizes in a db (basic)
View Index recommendations
-- 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
View config.json
{
"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",