Skip to content

Instantly share code, notes, and snippets.

Thilko Richter thilko

Block or report user

Report or block thilko

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:2cce5963883855af72067c847c8d87ab
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:
View DiamondKataTest.java
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 Aug 29, 2015
Roman numerals kata
View kata.java
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 Nov 11, 2014
A java version of game of line shamelessy stolen from rosetta code.
View gdcr14 game of life refactoring session
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);
View gist:7986810
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.
View gist:7927171
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 Sep 24, 2012
jira team_dashboard integration sample
View gist:3776056
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 Oct 30, 2011
code retreat links
View gist:1326295
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 Jun 20, 2011
A fortune rspec formatter. Make all your specs pass to get a new fortune!
View FortuneFormatter.rb
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?
View search result parsing with c.c
// 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 );
You can’t perform that action at this time.