Skip to content

Instantly share code, notes, and snippets.

View epochcoder's full-sized avatar

Willie Scholtz epochcoder

View GitHub Profile
@epochcoder
epochcoder / ProductPortfolioCollector.java
Created November 29, 2017 15:56
An example product portfolio collector for the Backbase connect Targeting workshop
package com.backbase.connect.mockproducts;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.backbase.cxp.targeting.api.Collector;
import com.backbase.cxp.targeting.contexts.AbstractContextCollector;
import com.backbase.cxp.targeting.contexts.definition.CollectorType;
import com.backbase.cxp.targeting.contexts.definition.OperatorPrimitive;
import com.backbase.cxp.targeting.contexts.definition.SelectorDefinition;
@epochcoder
epochcoder / install-active-mq.sh
Created September 6, 2017 12:54
Installs ActiveMQ as a service on an Ubuntu system
#!/usr/bin/env bash
function downloadCacheCopy() {
local name="$1"
local file_dir="$2"
local url="$3"
local location="$4"
local is_tar="$5"
echo "Preparing $name"
// ==UserScript==
// @name GoCD pipeline closer
// @namespace http://tampermonkey.net/
// @version 0.3
// @description Add close buttons to pipelines
// @author Willie Scholtz
// @match http://*/go/*
// @grant none
// ==/UserScript==
@epochcoder
epochcoder / docx4j-html-replacement
Created August 5, 2014 11:04
docx4j-html-replacement
/**
* Traverse a list of JAXB objects (eg. document.xml's document/body children), retrieve the w:p elements
* and run replacements on them according to the supplied map of identifiers and data
* @param mainPart the main document part
* @param replacements a map with an identifier as key and a list of paragraphs to replace the found one with
*/
private static void runReplacements(final MainDocumentPart mainPart, final Map<String, List<Object>> replacements) {
Preconditions.checkNotNull(mainPart, "the supplied main doc part may not be null!");
Preconditions.checkNotNull(replacements, "replacements may not be null!");
@epochcoder
epochcoder / HTML to POI Method
Created December 20, 2013 12:12
this method is meant as an aid to help convert complex html tables to POI (Excel). it accepts the current sheet and row, but keeps count of where your next column will be, colspans and rowspans are included, this method takes advantage of addMergedRegion(...)
/**
* adds a new cell to the current excel sheet with the HTML translated col- and row spans.
* @param sheet the current HSSFSheet
* @param row the current HSSFRow.
* @param style the style for this cell
* @param value the cell value.
* @param rowNum the current row number.
* @param colNum the current column number.
* @param rowSpan should there be a row-span here.
* @param colSpan should there be a col-span here.