Skip to content

Instantly share code, notes, and snippets.

View madstt's full-sized avatar

Mads Tjørnelund Toustrup madstt

View GitHub Profile
@madstt
madstt / gist:4037608
Created November 8, 2012 08:43
AutoMapper issues
Mapper.CreateMap<IFixedFrequencyLocalReportingPoint, LocalReportingPointDto>()
.ForMember(x => x.FrequencyId, opt => opt.MapFrom(x => x.Frequency.Id))
.ForMember(x => x.QualifiedName, opt => opt.MapFrom(x => x.GetQualifiedName()))
;
Mapper.CreateMap<ITemplateBase, TemplateBaseDto>()
.ConvertUsing<TemplateConverter>();
ITemplateBase template;
Mapper.Map<IFixedFrequencyLocalReportingPoint, LocalReportingPointDto>((IFixedFrequencyLocalReportingPoint)template);
@madstt
madstt / gist:4071068
Created November 14, 2012 08:56
Castle Windsor generics
CastleHelper.IocContainer.Register(
Component.For(typeof(IRepository<>)).ImplementedBy(typeof(NHibernateRepository<>)).Named("NHibernateRepository").LifeStyle.Is(LifestyleType.Transient));
var repo = (IRepository<T>)CastleHelper.IocContainer.Resolve(typeof(IRepository<T>));
// Gives me this exception:
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Castle.MicroKernel.Releasers.LifecycledComponentsReleasePolicy.Track(Object instance, Burden burden)
at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Track(Burden burden, IReleasePolicy releasePolicy)
@madstt
madstt / ClassWithAddin
Last active December 25, 2015 01:39
Combining ExpectedException and AutoData NUnit Addin in the same test assembly
[NUnitAddin]
public class ClassWithAddin : Ploeh.AutoFixture.NUnit2.Addins.Addin
{
protected IFixture Fixture;
protected void Setup()
{
Fixture = new Fixture();
}
}
@madstt
madstt / hello.csx
Last active August 29, 2015 14:02
Demoing ScriptCs support for Gists
Console.WriteLine("Hello from a Gist!!")
@madstt
madstt / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Keybase proof

I hereby claim:

  • I am madstt on github.
  • I am madstt (https://keybase.io/madstt) on keybase.
  • I have a public key whose fingerprint is A998 2E25 1100 A47F 32B6 6E6B A0B3 A7E6 2A2B 4C27

To claim this, I am signing this object:

@madstt
madstt / ng-show.html
Created March 19, 2015 12:27
ng-show
  <button ng-show="user.role==='admin'" ng-click="deletePost($index)">Delete Post</button>