Skip to content

Instantly share code, notes, and snippets.

View Boggin's full-sized avatar
💭
bleep bloop blorp

Richard Bogle Boggin

💭
bleep bloop blorp
View GitHub Profile
@Boggin
Boggin / WebFormMvcUtil.cs
Created October 25, 2012 08:09 — forked from SimonRice/RenderActionPartial.spark
Utility class to render MVC Partials & Actions in WebForms (or server side controls).
namespace Website
{
using System.IO;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
public class WebFormMvcUtil
{
private static HtmlHelper html;
namespace Demo.Ldap.Configuration
{
public LdapConfig(bool enabled, string user, string password, string domain)
{
this.Enabled = enabled;
this.User = user;
this.Password = password;
this.Domain = domain;
}
@Boggin
Boggin / EmailService.cs
Created October 15, 2013 15:26
Notification service with email as an example.
namespace Demo.Notification
{
using System.Net.Mail;
public class EmailService : IEmailService
{
public void Notify(NotificationDto notification)
{
var msg = new MailMessage
{
@Boggin
Boggin / Country.cs
Created October 15, 2013 15:48
Lookup tables for code-first Entity Framework (with auditing by FrameLog).
namespace Demo.Repository.Models
{
public class Country : Lookup
{
/// <summary>
/// Gets or sets the issues that link to this.
/// </summary>
/// <remarks>This may be referenced by many issues.</remarks>
public ICollection<Issue> Issues { get; set; }
}
@Boggin
Boggin / ApplicationContext.cs
Created October 15, 2013 16:00
Repository pattern infrastructure (with FrameLog auditing).
namespace Demo.Repository.Infrastructure
{
public class ApplicationContext : DbContext
{
public readonly FrameLogModule<ChangeSet, Person> Logger;
public ApplicationContext() : base("name=Demo")
{
Configuration.ProxyCreationEnabled = false;
Database.Initialize(true);
@Boggin
Boggin / IssueByNameSpecification.cs
Created October 15, 2013 16:08
Specification pattern for repository.
namespace Demo.Repository.Specifications
{
public class IssueByNameSpecification : Specification<Issue>
{
private readonly string key;
public IssueByNameSpecification(string key)
{
this.key = key;
}
@Boggin
Boggin / ApiAuthorizeAttribute.cs
Created October 17, 2013 15:46
MS Web API Authorize Attribute with Ninject 3.0
namespace Demo.WebMvc4.Infrastructure
{
using System.Web.Http;
public class ApiAuthorizeAttribute : AuthorizeAttribute
{
public Role Permission { get; set; }
// Note: Ninject currently doesn't support filter binding in Web API so this is a workaround.
protected AuthorizationService AuthorizationService

Keybase proof

I hereby claim:

  • I am boggin on github.
  • I am boggin (https://keybase.io/boggin) on keybase.
  • I have a public key whose fingerprint is 4548 9E13 27AA 9DAC C2F2 0527 96AC C195 ACFB 5646

To claim this, I am signing this object:

@Boggin
Boggin / level-meter.css
Last active August 29, 2015 14:04
AngularJS level-meter directive.
.level-meter__content {
background: #fff;
}
.level-meter__box {
fill: none;
stroke: #7d7d7d;
}
.level-meter__bar-empty {
fill: #7d7d7d;
stroke: #7d7d7d;
@Boggin
Boggin / MyController.cs
Last active January 19, 2016 15:02
A WebAPI Controller for an Azure WebRole that can manage a request that will take a long time to fulfill.
namespace WebRole.Controllers
{
public class MyController : ApiController
{
private readonly ICache cache;
private readonly IMyRequestQueue myRequestQueue;
public MyController(
ICache cache,