Skip to content

Instantly share code, notes, and snippets.

Paul Wellner Bou paulwellnerbou

Block or report user

Report or block paulwellnerbou

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View YourSolrContext.java
package de.wellnerbou.solr;
import de.wellnerbou.solr.CollectionAwareEntityInformationFacade;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.solr.core.SolrTemplate;
View Repository.java
package de.wellnerbou.solr;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.solr.core.SolrOperations;
import org.springframework.data.solr.core.query.SimpleQuery;
import org.springframework.data.solr.repository.query.SolrEntityInformation;
import org.springframework.data.solr.repository.support.SimpleSolrRepository;
public class YourRepository extends SimpleSolrRepository<YourSolrDocument, String> {
View CollectionAwareEntityInformationFacade.java
package de.wellnerbou.solr;
import org.springframework.data.solr.core.mapping.SimpleSolrMappingContext;
import org.springframework.data.solr.repository.query.SolrEntityInformation;
import org.springframework.data.solr.repository.support.SolrEntityInformationCreatorImpl;
public class CollectionAwareEntityInformationFacade<T, ID> implements SolrEntityInformation<T, ID> {
private SolrEntityInformation<T, ID> solrEntityInformation;
private String collectionName;
@paulwellnerbou
paulwellnerbou / example.java
Last active Oct 8, 2018
Code Examples Apache Commons Configuration2 Documentation
View example.java
/*
* First example from https://commons.apache.org/proper/commons-configuration/userguide/howto_reloading.html#Reloading_File-based_Configurations
*/
Parameters params = new Parameters();
// Read data from this file
File propertiesFile = new File("config.properties");
ReloadingFileBasedConfigurationBuilder<FileBasedConfiguration> builder =
new ReloadingFileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class)
@paulwellnerbou
paulwellnerbou / ReloadablePropertiesTest.java
Last active Feb 1, 2018
Unit test demonstrating behaviour of apache commons configuration
View ReloadablePropertiesTest.java
import org.apache.commons.configuration2.FileBasedConfiguration;
import org.apache.commons.configuration2.PropertiesConfiguration;
import org.apache.commons.configuration2.builder.ConfigurationBuilderEvent;
import org.apache.commons.configuration2.builder.ReloadingFileBasedConfigurationBuilder;
import org.apache.commons.configuration2.builder.fluent.Parameters;
import org.apache.commons.configuration2.event.Event;
import org.apache.commons.configuration2.event.EventListener;
import org.apache.commons.configuration2.ex.ConfigurationException;
import org.junit.Assert;
import org.junit.Before;
@paulwellnerbou
paulwellnerbou / page-flip-corner.svg
Created Nov 17, 2017
SVG Graphic for lower right page turning, designed carefully by hand, keeping the SVG code as simple as possible
View page-flip-corner.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paulwellnerbou
paulwellnerbou / switch-java.sh
Last active Nov 8, 2017
Shell script switching between two Java versions, including JAVA_HOME (which is not handled by update-alternatives)
View switch-java.sh
#!/bin/bash
set -u
JAVA7="/opt/jdk1.7.0_80"
JAVA8="/opt/jdk1.8.0_31"
# Assuming you have $JAVA_SYMLINK/bin in your path, in this case "/opt/jdk/bin"
JAVA_SYMLINK="/opt/jdk"
NEW_JAVA=$JAVA7
current=`readlink $JAVA_SYMLINK`
@paulwellnerbou
paulwellnerbou / embedded-hover-footnotes.js
Created Sep 28, 2017
JavaScript for embedded hover footnotes in Ghost 1.0 default theme
View embedded-hover-footnotes.js
/* Inject this code in your blog footer of your Ghost blog */
var createTooltip = function(tooltiptext) {
var tooltip = document.createElement('span');
tooltip.setAttribute('class', 'tooltiptext');
tooltip.innerHTML = tooltiptext;
return tooltip;
}
var appendTooltipTo = function(element, tooltipText) {
element.append(createTooltip(tooltipText));
}
@paulwellnerbou
paulwellnerbou / embedded-hover-footnotes.css
Last active Sep 28, 2017
CSS for embedded hover footnotes in Ghost 1.0 default theme
View embedded-hover-footnotes.css
/* Thanks to w3schools for the base sample implementation of tooltips with CSS only:
https://www.w3schools.com/howto/howto_css_tooltip.asp */
.tooltip {
position: relative;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 240px;
background-color: #555;
color: #fff;
@paulwellnerbou
paulwellnerbou / embedded-hover-footnotes.html
Created Sep 28, 2017
Create embedded hover-Footnotes for Ghost 1.0's default theme
View embedded-hover-footnotes.html
<!-- Thanks to w3schools for the base sample implementation:
https://www.w3schools.com/howto/howto_css_tooltip.asp
Put this in the "Code inject" of your Ghost 1.0 Blog Footer. -->
<style>
.tooltip {
position: relative;
}
.tooltip .tooltiptext {
You can’t perform that action at this time.