Skip to content

Instantly share code, notes, and snippets.

View banterCZ's full-sized avatar

Luboš Račanský banterCZ

View GitHub Profile
@banterCZ
banterCZ / Sample.java
Last active December 20, 2015 13:39
inherit javadoc, sample for blogpost http://blog.zvestov.cz/item/136
public interface Sample {
/**
* Some javadoc.
*/
void doSomething();
/**
* Another javadoc.
*/
@banterCZ
banterCZ / AbstractEntity.java
Last active December 20, 2015 16:58
JPA abstract entity - verbose
import javax.persistence.MappedSuperclass;
@MappedSuperclass
public abstract class AbstractEntity<PK> {
public abstract PK getId();
public abstract void setId(PK id);
@Override
@banterCZ
banterCZ / AbstractEntity.java
Last active June 21, 2020 09:40
JPA abstract entity - better way
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
@MappedSuperclass
public abstract class AbstractEntity<PK extends Serializable> {
public static final String GENERATOR = "customSequence";
sudo apt-get install \
mc \
tree \
gimp \
xpaint \
subversion \
git \
mercurial \
vim-gnome \
synaptic \
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import static org.junit.runners.Parameterized.Parameters
import static org.junit.Assert.assertEquals
/**
* @author banterCZ
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.rules.ErrorCollector
import org.openqa.selenium.By
import org.openqa.selenium.remote.DesiredCapabilities
import org.openqa.selenium.remote.RemoteWebDriver
import static org.hamcrest.core.Is.*
@banterCZ
banterCZ / Accumulator.groovy
Last active August 29, 2015 14:02
We want to write a function that generates accumulators-- a function that takes a number n, and returns a function that takes another number i and returns n incremented by i. See the article Revenge of the Nerds http://www.paulgraham.com/icad.html
def foo(n) {
return {n += it}
}
def accumulator = foo(1)
assert accumulator(2) == 3
assert accumulator(3) == 6
@banterCZ
banterCZ / Accumulator.scala
Last active August 29, 2015 14:03
We want to write a function that generates accumulators-- a function that takes a number n, and returns a function that takes another number i and returns n incremented by i. See the article Revenge of the Nerds http://www.paulgraham.com/icad.html This Scala solution comes from http://rosettacode.org/wiki/Accumulator_factory#Scala
def AccumulatorFactory[N](n: N)(implicit num: Numeric[N]) = {
import num._
var acc = n
(inc: N) => {
acc = acc + inc
acc
}
}
@banterCZ
banterCZ / Accumulator.clj
Created July 11, 2014 14:10
We want to write a function that generates accumulators-- a function that takes a number n, and returns a function that takes another number i and returns n incremented by i. See the article Revenge of the Nerds http://www.paulgraham.com/icad.html This Clojure solution comes from http://rosettacode.org/wiki/Accumulator_factory#Clojure
(defn accum [n]
(let [acc (atom n)]
(fn [m] (swap! acc + m))))
@banterCZ
banterCZ / pom-module.xml
Created March 23, 2015 12:37
maven multi-module build sample
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>parent</artifactId>
<groupId>cz.zvestov.mvn-multimodule-sample</groupId>
<version>1.0.0-SNAPSHOT</version>