Skip to content

Instantly share code, notes, and snippets.

@ralfw
ralfw / romanconverter.cs
Last active August 29, 2015 14:02
Informed TDD - JUGHH 17.6.2014
/*
* Ralf Westphal, Hamburg
* info@ralfw.de, @ralfw, http://blog.ralfw.de
*/
using System;
using System.Linq;
using System.Collections.Generic;
namespace kata
{
@ralfw
ralfw / keybase.md
Created September 28, 2014 17:30
Keybase proof

Keybase proof

I hereby claim:

  • I am ralfw on github.
  • I am ralfwestphal (https://keybase.io/ralfwestphal) on keybase.
  • I have a public key whose fingerprint is DB86 CB14 FBC9 3336 36CE EFC5 0B02 0605 E101 C2ED

To claim this, I am signing this object:

@ralfw
ralfw / hexdmperV1.cs
Created October 1, 2014 19:42
Hex Dump Anwendung strukturiert nach IOSP/PoMO. Inspiriert durch das Buch "Head First C#". Erklärung s.a. hier: http://blog.ralfw.de/2014/10/responsibilities-zahlen.html Und hier noch der ursprüngliche Brownfield-Code: https://gist.github.com/ralfw/d26ad56ee7310e89ae6d
using System;
using System.IO;
namespace headfirst.hexdmper
{
class MainClass
{
public static void Main (string[] args)
{
var filename = Get_filename_from_commandline (args);
@ralfw
ralfw / primegenerator.cs
Last active August 29, 2015 14:07
Prime number generation refactored to IOSP/PoMO
using System;
using System.Collections.Generic;
namespace GeneratePrimes.FlowDesign
{
public class PrimeGenerator
{
const int SMALLEST_POSSIBLE_PRIME = 2;
@ralfw
ralfw / tannenbaum.groovy
Last active August 29, 2015 14:12
Weihnachtskata 2014 - Tannenbaum
/**
* Created by ralfw on 24.12.14.
* Coding Dojo der CCD SchooL: http://ccd-school.de/coding-dojo/
* Kata-Beschreibung: https://app.box.com/files/0/f/885439646/1/f_15903236703
*/
class Display {
void ausgeben(String text) {
println text
}
@ralfw
ralfw / umbreche.java
Created February 2, 2015 07:46
Textumbruch Lösung von Klaus
package version1;
import java.util.ArrayList;
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Scanner;
public class Umbreche {
@ralfw
ralfw / 01inlinedesign.cs
Last active August 29, 2015 14:14
Inline flows
// flow defined inline
public ExportReport Export(DateTime fromMonth, DateTime toMonth) {
// create month range
// get balance sheets for month range
// extract transaction items
// create filename
// export
// create export report
}
@ralfw
ralfw / pathfinder.cs
Last active August 29, 2015 14:14
Feuerwehr
class Pathfinder{
public int Determine_distance(Node start, Node destination) {
var min_distance_found = int.MaxValue;
Find_paths (start, destination,
new List<Edge> (),
ref min_distance_found);
return min_distance_found;
}
@ralfw
ralfw / streamOfT.cs
Last active August 29, 2015 14:14
Simple streams based on IEnumerable
class Stream<T> : IEnumerable<T> {
private IEnumerable<T> generator;
public Stream(IEnumerable<T> generator) { this.generator = generator; }
private StreamEnumerator<T> enumerator;
public Stream() { this.enumerator = new StreamEnumerator<T> (); }
public void Enqueue(T element) {
this.enumerator.Enqueue (element);
@ralfw
ralfw / 01ConsoleServiceProvider.cs
Last active August 29, 2015 14:15
CLI µService Adapters
using System;
using System.Collections.Generic;
using System.Diagnostics;
public class ConsoleServiceProvider : IDisposable
{
private readonly string serviceFilepath;
private readonly string commandlineParams;