Skip to content

Instantly share code, notes, and snippets.

View nathanwoulfe's full-sized avatar

Nathan Woulfe nathanwoulfe

View GitHub Profile
@nathanwoulfe
nathanwoulfe / WhereIsMyMockedUser.cs
Created April 12, 2018 05:50
Where is my mocked user? How do I get him onto my context?
public GroupControllerTests()
{
// do some other setup stuff first
Mock<WebSecurity> webSecurity = new Mock<WebSecurity>(null, null);
// only need a couple of properties, enough to build a string and stuff
var currentUser = Mock.Of<IUser>(u =>
u.IsApproved
&& u.Name == Utility.RandomString()
@nathanwoulfe
nathanwoulfe / youtube-tracking.js
Last active August 13, 2017 23:19
An example AngularJs directive using the YouTube iFrame API, pushing events into the GTM datalayer
// functional demo at http://www.usc.edu.au/open-day#sessions
(function() {
'use strict'
function hubVideo() {
var video = {
restrict: 'E',
replace: true,
scope: {
@nathanwoulfe
nathanwoulfe / UmbracoCustomIndexer
Created June 24, 2015 04:33
Index Archetype content in Umbraco - a custom search indexer
namespace Your.Namespace {
class CustomIndexer : UmbracoContentIndexer {
protected override Dictionary<string, string> GetDataToIndex(XElement node, string type)
{
Dictionary<string,string> data = base.GetDataToIndex(node, type);
string content = "";
if (data.ContainsKey("archetypeAlias"))