Skip to content

Instantly share code, notes, and snippets.

public class Attributes {
private final Map<String, Set<String>> attributes;
public Attributes() {
this.attributes = new HashMap<>();
}
public boolean attributeExists(String attributeName) {
return attributes.containsKey(attributeName);
}
public class Item {
private final Attributes attributes;
public Item(Attributes attributes) {
this.attributes = attributes;
}
public boolean attributeExists(String attributeName) {
return attributes.attributeExists(attributeName);
}
@eyalgo
eyalgo / maven-settings.sh
Created February 28, 2014 23:10
Small settings file for maven to be loaded (M2_HOME and M2)
# /etc/profile.d/maven-settings.sh Maven related stuff
export M2_HOME=/usr/local/apache-maven/apache-maven-3.2.1
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
@eyalgo
eyalgo / java-settings.sh
Last active August 29, 2015 13:56
Settings of java under profile.d (JAVA_HOME and path)
# /etc/profile.d/java-settings.sh
OLD
# export JAVA_HOME=/usr/java/jdk1.7.0_51
# export PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME=/usr/java/jdk1.8.0
# Basic
git config --global alias.st status
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.br branch
# Branches
git config --global alias.buf "checkout -b"
git config --global alias.puf "push -u origin"
@eyalgo
eyalgo / .gitignore-intellij
Created March 7, 2014 20:54
gitignore for IntelliJ
### Java ###
*.class
# Package Files #
*.jar
*.war
*.ear
### IntelliJ ###
*.iml
@eyalgo
eyalgo / pgsql-data-settings.sh
Last active August 29, 2015 13:57
Environment settings for PostgreSQ
# /etc/profile.d/pgsql-data-settings.sh
export PGDATA=/usr/local/pgsql/data
@eyalgo
eyalgo / SafeGetCollectionFromMap.java
Last active August 29, 2015 13:58
Safe get from map that holds Collection as value
// The code
public static <T, V> Collection<V> safeGetCollectionFromMap(Map<T, ? extends Collection<V>> map, T key) {
if (map.get(key) != null) {
return map.get(key);
} else {
return Lists.newLinkedList();
}
}
// The tests
# create a new branch out of current branch
git checkout -b <NEW_FEATURE_BRANCH_NAME>
# share the branch
git push -u origin <BRANCH_NAME>
# show all branches
git remote show origin
# Delete remotely
@eyalgo
eyalgo / pom.xml
Last active August 29, 2015 14:02
Skeleton pom file.Contains compiler plugin and test dependencies
<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>
<groupId> put the group id </groupId>
<artifactId> put the artifact id </artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name> the name </name>