Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike Bild MikeBild

View GitHub Profile
View DisplayNameByResourceKeyAttribute.cs
public class DisplayNameByResourceKeyAttribute : DisplayNameAttribute
{
public DisplayNameByResourceKeyAttribute(string resourceKey)
{
DisplayNameValue = DisplayNameByResourceKey(resourceKey) ?? resourceKey;
}
private static string DisplayNameByResourceKey(string value)
{
return null;
View Rx_Observer_Observables.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class Program2
{
View Rx_FizzBuzz.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
View CodeKataPickAkin.cs
/*
http://ilker.de/code-kata-pickakin
akinList = [A1,B2,A2,A3,B3,A4,D1,D2,B1]
ceoList = [C1,E1,E2]
controlList = [F1]
*/
var ceoListOriginal = new List<string>() {"A1", "B1", "A2", "A3", "C1", "D1", "E1", "E2"};
View ViewModelField.cs
public class ViewModelField<T> : INotifyPropertyChanged
{
private T _value;
public T Value
{
get { return _value; }
set
{
_value = value;
PropertyChanged(this, new PropertyChangedEventArgs("Value"));
@MikeBild
MikeBild / rakefile.rb
Created Jun 18, 2011
MSpec to JUnit Test Report Rake
View rakefile.rb
require 'rake'
require './transform_mspec_report'
desc "Done..."
task :default => [:mspec, :transform] do
puts "Done..."
end
desc "Generate MSpec test report."
task :mspec do
View transform_mspec_report.rb
require "nokogiri"
class TransformMSpecReport
def self.transform()
doc = Nokogiri::XML(File.read('test_result.xml'))
xslt = Nokogiri::XSLT(File.read('mSpec2JUnit.xslt'))
doc = xslt.transform(doc)
File.open('test_result_junit.xml', 'w') {|f| f.write(doc) }
puts "File transformed."
end
@MikeBild
MikeBild / mSpec2JUnit.xslt
Created Jun 18, 2011
MSpec to JUnit XSLT
View mSpec2JUnit.xslt
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="specs" select="//specification"/>
<xsl:template match="MSpec">
<testsuite
name="Specifications"
tests="{count($specs)}"
errors="0"
@MikeBild
MikeBild / ZeroMqDocumentSaga.cs
Created Feb 15, 2012
Minimod.MessageProcessor and Minimod.ZeroMqMessageStream as Document Saga (Message) Demo
View ZeroMqDocumentSaga.cs
using System;
using System.Reactive.Linq;
using Minimod.MessageProcessor;
using Minimod.ZeroMqMessageStream;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
View rx-test
var sut = Observable.Start(() =>
{
return "Demo";
});
var testScheduler = new Microsoft.Reactive.Testing.TestScheduler();
var actual = testScheduler.Start(() => sut);
Microsoft.Reactive.Testing.ReactiveAssert.AreElementsEqual(actual.Messages, new[] {
new Recorded<Notification<string>>(200, Notification.CreateOnNext("Demo")),
You can’t perform that action at this time.