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
/* | |
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
#!/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
(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
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
/* | |
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
/* | |
------------------------------------------------------------------------------ | |
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
// Rust Builder Pattern Example | |
struct Foo { | |
x: i32, | |
y: i32, | |
z: i32 | |
} | |
struct FooBuilder { | |
x: i32, |
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
/* | |
This example shows how to connect to PostgreSQL database server using the `DriverManager` class. | |
It is recommended to use `DataSource` class instead because of connection pooling. | |
compile: javac DatabaseConnectionDemo.java | |
execute: java -cp .;lib\postgresql-X.X.XXXX.jar DatabaseConnectionDemo | |
*/ | |
//package io.uetoyo.gists; |
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
@echo off | |
:: Create the basic SBT project structure. | |
:: Does not overwrite existing project folder. | |
:: Use the command `rd /s /q {folder-name}` for removing existing folder. | |
:: version 0.1 | |
:: author: David Landa | |
:: license: http://creativecommons.org/licenses/by-sa/2.5/ |