Skip to content

Instantly share code, notes, and snippets.

View vfarcic's full-sized avatar

Viktor Farcic vfarcic

View GitHub Profile
package com.technologyconversations.java8exercises.streams;
import java.util.*;
import static java.util.stream.Collectors.*;
public class Partitioning {
public static Map<Boolean, List<Person>> partitionAdults7(List<Person> people) {
Map<Boolean, List<Person>> map = new HashMap<>();
map.put(true, new ArrayList<>());
package com.technologyconversations.java8exercises.streams;
import org.junit.Test;
import java.util.List;
import java.util.Map;
import static com.technologyconversations.java8exercises.streams.Grouping.*;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
package com.technologyconversations.java8exercises.streams;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static java.util.stream.Collectors.*;
public class Grouping {
package com.technologyconversations.java8exercises.streams;
import org.junit.Test;
import java.util.List;
import static com.technologyconversations.java8exercises.streams.Joining.namesToString;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
package com.technologyconversations.java8exercises.streams;
import java.util.List;
import static java.util.stream.Collectors.joining;
public class Joining {
public static String namesToString7(List<Person> people) {
String label = "Names: ";
@vfarcic
vfarcic / bdd.yml
Created December 26, 2014 22:40
provisioning/bdd.yml
- hosts: all
remote_user: vagrant
sudo: yes
roles:
- etcd
- confd
- docker
- nginx
- bdd
- name: Docker is present
apt: name=docker.io state=present
tags: [docker]
- name: Python-pip is present
apt: name=python-pip state=present
tags: [docker]
- name: Docker-py is present
pip: name=docker-py version=0.4.0 state=present
tags: [docker]
- name: TOML is present
copy:
src=bdd.toml
dest=/etc/confd/conf.d/bdd.toml
tags: [bdd]
- name: Config template is present
copy:
src=bdd.conf.tmpl
dest=/etc/confd/templates/bdd.conf.tmpl
tags: [bdd]
#!/bin/sh
BLUE_PORT=9001
GREEN_PORT=9002
CURRENT_COLOR=$(etcdctl get /bdd/color)
if [ "$CURRENT_COLOR" = "" ]; then
CURRENT_COLOR="green"
fi
if [ "$CURRENT_COLOR" = "blue" ]; then
PORT=$GREEN_PORT
@vfarcic
vfarcic / Vagrantfile
Created January 24, 2015 19:27
Ubuntu
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.synced_folder ".", "/vagrant"
config.vm.provider "virtualbox" do |v|
v.name = "books-service"