This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
------------------------------------------------------------------------------ | |
Popis: | |
Úkolem bylo ukázat, jak vytáhnout různá ověření na atributy osoby mimo samotnou | |
třídu osoba. Osoba zná svůj věk, ale neví jestli je plnoletá či smí na horskou dráhu. | |
Takové omezení přichází až z vnějšku a je závislé na kontextu, např. plnoletost je | |
jinak definována v USA než v EU. | |
1) Bude mít rozšíření které ověří, jestli osoba smí pít alkohol (min. 18 let). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Specification Pattern | |
Simple use case: We have a person class with a birthdate attribute and we want to know if he is an adult. | |
The straigtforward approach is create the custom parametrized specification. | |
*/ | |
import java.time.Period; | |
import java.time.LocalDate; | |
public class FluentSpecificationExample { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -c "import sys; print('\n'.join(sys.path))" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns app.core | |
(:require | |
[clojure.java.jdbc :as jdbc])) | |
(def oracle-db-spec | |
{:classname "oracle.jdbc.Driver" | |
:subprotocol "oracle:thin" | |
:subname "//@host:port/name" | |
:user "USER" | |
:password "PASS"}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# current Git branch | |
branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') | |
# v1.0.0, v1.5.2, etc. | |
versionLabel=v$1 | |
# establish branch and tag name variables | |
devBranch=develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Ukázka jak implementovat jednoduchý *value object*. | |
*/ | |
#include <string> | |
#include <stdexcept> | |
#include <iostream> | |
template<typename T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Jednoduchá realizace n-gramu. | |
""" | |
def ngrams(words, n): | |
return zip(*[words[i:] for i in range(n)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Hamming distance between two sequences. | |
Hamingova vzdálenost je metrika; splňuje předpoklady: | |
Předpoklad: | |
a) H(x, y) >= 0 a H(x, y) = 0 právě když x = y; | |
b) H(x, y) = H(y, x) komutace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
""" | |
Script for generating unique IDs for persons. | |
The script accepts command line arguments stating how many IDs should be generated, | |
if the number of IDs is not defined or it is not a number, the script will generate | |
default number of IDs (which is set to 10000). | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# output binary | |
BIN := test | |
# source files | |
SRCS := \ | |
test.cpp | |
# files included in the tarball generated by 'make dist' (e.g. add LICENSE file) | |
DISTFILES := $(BIN) |