Skip to content

Instantly share code, notes, and snippets.

View haraldfianbakken's full-sized avatar

Harald S. Fianbakken haraldfianbakken

View GitHub Profile
@haraldfianbakken
haraldfianbakken / gist:5378465
Created April 13, 2013 13:45
Not allowed inheritance by structuremap
public class SecureController : Controller
{
protected SecureController(IMemberService memberService, ISecurityContext securityContext) : base(memberService, securityContext)
{
}
}
public class AccountController : SecureController
{
public AccountController(IMemberService memberService,ISecurityContext securityContext) : base(memberService,securityContext)
@haraldfianbakken
haraldfianbakken / gist:5378460
Created April 13, 2013 13:44
Allowed inheritance - Structuremap
public class SecureController : Controller
{
public SecureController(IMemberService memberService, ISecurityContext securityContext) : base(memberService, securityContext)
{
}
}
public class AccountController : SecureController
{
public AccountController(IMemberService memberService,ISecurityContext securityContext) : base(memberService,securityContext)
@haraldfianbakken
haraldfianbakken / gist:5115167
Last active December 14, 2015 16:29
Powershell wrapper - Admin job
while($true){
$error = Get-SPLogEvent -StartTime ([DateTime]::Now).Subtract([Timespan]::FromHours(1))|? { $_.Level -eq "Error" -or $_.Level -eq "Critical"}
if($error){
[ibuddylib.BuddyManager]::Global.AnyBuddy.HeadColor = "Red";
Start-Sleep -Minutes 5;
[ibuddylib.BuddyManager]::Global.AnyBuddy.HeadColor = "Off";
} else{
@haraldfianbakken
haraldfianbakken / gist:5115132
Created March 8, 2013 08:58
Buddy commands - REST API
using System;
using System.Web.Mvc;
using ibuddylib;
namespace SharePirates.BuddyWeb.Controllers
{
public class BuddyController : Controller, IBuddyCommands
{
private static BuddyAnimator _animator;
@haraldfianbakken
haraldfianbakken / gist:5115121
Created March 8, 2013 08:57
IBuddyCommands (REST)
using System.Web.Mvc;
namespace SharePirates.BuddyWeb.Controllers
{
public interface IBuddyCommands
{
ActionResult Flash(string color);
ActionResult Twist();
ActionResult HeartBeat(int ms=-1);
ActionResult HeadColor(string color);
@haraldfianbakken
haraldfianbakken / gist:5115090
Created March 8, 2013 08:50
Buddy interface
namespace ibuddylib {
public enum TorsoYaw { Middle, Left, Right };
public enum WingPosition { Low, High };
public enum HeadColor { Off, White, Cyan, Purple, Blue, Yellow, Green, Red };
public enum HeartLight { Off, On };
/// <summary>
/// The interface that both physical and virtual i-Buddies respond to
/// </summary>
public interface IBuddy {
@haraldfianbakken
haraldfianbakken / gist:5115075
Created March 8, 2013 08:47
Device management for IBUDDY
using System;
using System.Collections;
using System.Data;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace GenericHid
{
internal sealed partial class DeviceManagement
{