Skip to content

Instantly share code, notes, and snippets.

View thilko's full-sized avatar

Thilko Richter thilko

View GitHub Profile
@thilko
thilko / gist:2cce5963883855af72067c847c8d87ab
Last active January 12, 2019 09:56
Shopping Cart kata
Implement the code for a supermarket checkout that calculates the total price of a number of items. Products can be scanned and at the end a receipt be printed.
1. A product at a time can be scanned. Customer can see a subtotal which shows just the total of all scanned products.
2. Checkout can print a receipt which contains the Product and the price.
3. Multiple products of one type can be scanned, i.e two milks at once.
4. Products can have a price per weight i.e. apples with costs 2.50€/kg.
5. Discount: if a customer buys 2 bottles of milk they get the two for the price of one
6. Discount: if a customer buys 5 bars of chocolate they receive a discount of 10% for the total price of the chocolates
Example products:
@thilko
thilko / DiamondKataTest.java
Last active April 2, 2016 18:51
Diamond Kata
import static java.util.Arrays.asList;
import org.hamcrest.MatcherAssert;
import static org.hamcrest.core.Is.is;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.StringJoiner;
@thilko
thilko / kata.java
Last active August 29, 2015 14:16
Roman numerals kata
import org.junit.Test;
import java.util.Collections;
import java.util.TreeMap;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
public class FizzBuzzTest {
// doc:
@thilko
thilko / gdcr14 game of life refactoring session
Created November 11, 2014 15:43
A java version of game of line shamelessy stolen from rosetta code.
public class GameOfLife{
public static void main(String[] args){
String[] dish= {
"_#_",
"_#_",
"_#_",};
int gens= 3;
for(int i= 0;i < gens;i++){
System.out.println("Generation " + i + ":");
print(dish);
Stefan Tilkov: Was ist mit Vollständigkeit? Ist es wichtig, dass ich alles dokumentiert habe?
Wie detailliert muss denn Architekturdokumentation sein?
Gernot Starke: Das ist total überbewertet. Ich bekomme die Krise, wenn mir jemand sagt:
„Ich will vollständige Dokumentation haben.” Das ist dieser 70er und 80er Jahre
Ansatz – „Ich kann die gesamten Daten eines Unternehmens alle genau modellieren” - welch ein Blödsinn.
Niemals kann ich das machen. Ich will keine vollständige Dokumentation,
sondern relevante, aktuelle und verständliche haben. Das ist mir viel wichtiger als vollständig.
13:02:57.142 [DEBUG] [org.gradle.logging.internal.DefaultLoggingConfigurer] Finished configuring with level: DEBUG, configurers: [org.gradle.logging.internal.OutputEventRenderer@697748ae, org.gradle.logging.internal.logback.LogbackLoggingConfigurer@1644cd9a, org.gradle.logging.internal.JavaUtilLoggingConfigurer@7f1644e1]
13:02:57.783 [DEBUG] [org.gradle.logging.internal.DefaultLoggingConfigurer] Finished configuring with level: DEBUG, configurers: [org.gradle.logging.internal.OutputEventRenderer@697748ae, org.gradle.logging.internal.logback.LogbackLoggingConfigurer@1644cd9a, org.gradle.logging.internal.JavaUtilLoggingConfigurer@7f1644e1]
13:02:57.785 [INFO] [org.gradle.BuildLogger] Starting Build
13:02:57.786 [DEBUG] [org.gradle.BuildLogger] Gradle user home: C:\Users\testuser\.gradle
13:02:57.786 [DEBUG] [org.gradle.BuildLogger] Current dir: C:\testproject\code\javafx-testlist
13:02:57.787 [DEBUG] [org.gradle.BuildLogger] Settings file: null
13:02:57.787 [DEBUG] [org.gradle.BuildLogger] Build file: null
13:0
@thilko
thilko / gist:3776056
Created September 24, 2012 13:53
jira team_dashboard integration sample
module Sources
module Number
module Jira
def tickets_for_filter_id(filter_id)
uri = URI('http://jira.blau.de/rest/api/latest/search')
params = { :maxResults => "1000", :jql => "filter = #{filter_id}"}
uri.query = URI.encode_www_form(params)
req = Net::HTTP::Get.new(uri.request_uri)
req.basic_auth 'user_name', 'xxxxxx'
@thilko
thilko / gist:1326295
Created October 30, 2011 19:10
code retreat links
how to organize a code retreat from alex boloaca
http://bit.ly/9nzhql
... and another page
http://bit.ly/bRTX5D
introduction about code retreats from the inventor
http://coderetreat.com
the role of the facilitator
@thilko
thilko / FortuneFormatter.rb
Created June 20, 2011 20:01
A fortune rspec formatter. Make all your specs pass to get a new fortune!
require 'rspec/core/formatters/progress_formatter'
require "net/http"
class FortuneFormatter < RSpec::Core::Formatters::ProgressFormatter
def stop
super
print_fortune if all_passed?
end
def all_passed?
// Taken from: http://www.ietf.org/rfc/rfc1823.txt
/* step through each entry returned */
for ( e = ldap_first_entry( ld, res ); e != NULL;
e = ldap_next_entry( ld, e ) ) {
/* print each attribute */
for ( a = ldap_first_attribute( ld, e, &ptr );
a != NULL;
a = ldap_next_attribute( ld, e, ptr ) ) {
printf( "attribute: %s0, a );