Skip to content

Instantly share code, notes, and snippets.

@l0co
l0co / e4-dark_partstyle.css
Last active November 15, 2018 16:32
A fix for Eclipse Neon with dark GTK theme displaying dark background for Flowable Designer, changing it to light one
/*******************************************************************************
* Copyright (c) 2010, 2014 Andrea Guarinoni and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andrea Guarinoni <[email protected]> - initial API and implementation
* Lars Vogel - initial API and implementation
@l0co
l0co / ValidationMessages_pl.properties
Last active June 1, 2018 17:14
HIbernate 5 polish validation messages ValidationMessages_pl.properties
javax.validation.constraints.AssertFalse.message = musi by\u0107 fa\u0142szem
javax.validation.constraints.AssertTrue.message = musi by\u0107 prawd\u0105
javax.validation.constraints.DecimalMax.message = musi by\u0107 mniejsze ${inclusive \=\= true ? 'lub r\u00F3wne od ' \: ''}{value}
javax.validation.constraints.DecimalMin.message = musi by\u0107 wi\u0119ksze ${inclusive \=\= true ? 'lub r\u00F3wne od ' \: ''}{value}
javax.validation.constraints.Digits.message = niepoprawna warto\u015B\u0107 numeryczna (oczekiwano <{integer} digits>.<{fraction} digits>)
javax.validation.constraints.Future.message = musi by\u0107 przysz\u0142\u0105 dat\u0105
javax.validation.constraints.FutureOrPresent.message = musi by\u0107 aktualn\u0105 lub przysz\u0142\u0105 dat\u0105
javax.validation.constraints.Max.message = musi by\u0107 mniejsze lub r\u00F3wne od {value}
javax.validation.constraints.Min.message = musi by\u0107 wi\u0119ksze lub r\u00F3wne od {value}
javax.validation.constraints.Negative.message = musi by\u0107 mniejsze
@l0co
l0co / 4-single-table.java
Created September 19, 2015 10:07
How to avoid subclasses join in Hibernate model - model 4 - single table
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = Super.DISCRIMINATOR_COLUMN, discriminatorType = DiscriminatorType .STRING, length = 255)
public class Super {
public static final String DISCRIMINATOR_COLUMN = "classname";
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
protected long id;
@l0co
l0co / 3-explicit-polymorphism-on-sub.java
Created September 19, 2015 10:05
How to avoid subclasses join in Hibernate model - model 3 - explicit polymorphism on sub
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = Super.DISCRIMINATOR_COLUMN, discriminatorType = DiscriminatorType .STRING, length = 255)
public class Super {
public static final String DISCRIMINATOR_COLUMN = "classname";
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
protected long id;
@l0co
l0co / 2-explicit-polymorphism-on-super.java
Created September 19, 2015 10:04
How to avoid subclasses join in Hibernate model - model 2 - explicit polymorphism on super
@Entity
@Polymorphism(type = PolymorphismType.EXPLICIT)
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = Super.DISCRIMINATOR_COLUMN, discriminatorType = DiscriminatorType .STRING, length = 255)
public class Super {
public static final String DISCRIMINATOR_COLUMN = "classname";
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@l0co
l0co / 1-plain-joined.java
Created September 19, 2015 10:02
How to avoid subclasses join in Hibernate model - model 1 - plan joined
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = Super.DISCRIMINATOR_COLUMN, discriminatorType = DiscriminatorType .STRING, length = 255)
public class Super {
public static final String DISCRIMINATOR_COLUMN = "classname";
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
protected long id;
@l0co
l0co / GenericRepository.java
Last active August 28, 2015 18:39
Statistics queries with time range for PostgreSQL and Hibernate - GenericRepository
import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.ProjectionList;
import org.hibernate.criterion.Projections;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
import java.util.List;
public class GenericRepository {
@l0co
l0co / PostgresDateTrunc.java
Last active August 28, 2015 18:41
Statistics queries with time range for PostgreSQL and Hibernate - PostgresDateTrunc
public enum PostgresDateTrunc {
second,
minute,
hour,
day,
week,
month,
quarter,
year;
@l0co
l0co / modal.html
Last active August 29, 2015 14:25
Modal windows available by URL binding in AngularJS with ui-bootstrap and ui-router
<html>
<body ui-view="main">
</body>
</html>
@l0co
l0co / angular-equals.js
Created July 18, 2015 09:52
Angular hard limit recursion in equals()
var currentEqualsLevel = 0;
var maxEqualsLevel = 10;
function equals(o1, o2) {
if (currentEqualsLevel>=maxEqualsLevel)
return true; // we consider objects equal to this level
if (o1 === o2) return true;
if (o1 === null || o2 === null) return false;