Skip to content

Instantly share code, notes, and snippets.

View paulwellnerbou's full-sized avatar

Paul Wellner Bou paulwellnerbou

View GitHub Profile
<script id="disqus-script" data-disqusName="your-disqus-name"
data-element="selector-of-element-where-to-append-disqus-container"
src="https://cdn.rawgit.com/paulwellnerbou/a09e3819307851993df0aba65b266e86/raw/ee408decdfbb8df5180894741dc59a5423d706a6/embed-disqus.js"/>
@paulwellnerbou
paulwellnerbou / embed-disqus.js
Last active September 26, 2017 06:52
Javascript resource to embed disqus in your Ghost blog (or any other website) just with data-attributes
/** Usage:
Place this tag at the end of your HTML:
<script id="disqus-script" data-disqusName="your-disqus-name" data-element="selector-of-element-where-to-append-disqus-container"
src="https://cdn.rawgit.com/paulwellnerbou/a09e3819307851993df0aba65b266e86/raw/ee408decdfbb8df5180894741dc59a5423d706a6/embed-disqus.js"/>
Original version: https://gist.github.com/paulwellnerbou/a09e3819307851993df0aba65b266e86
*/
var disqus = document.getElementById('disqus-script');
var disqusName = disqus.getAttribute('data-disqusName');
@paulwellnerbou
paulwellnerbou / embedded-hover-footnotes.html
Created September 28, 2017 15:58
Create embedded hover-Footnotes for Ghost 1.0's default theme
<!-- 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 {
@paulwellnerbou
paulwellnerbou / embedded-hover-footnotes.css
Last active September 28, 2017 16:01
CSS for embedded hover footnotes in Ghost 1.0 default theme
/* 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.js
Created September 28, 2017 16:03
JavaScript for embedded hover footnotes in Ghost 1.0 default theme
/* 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 / switch-java.sh
Last active November 8, 2017 07:58
Shell script switching between two Java versions, including JAVA_HOME (which is not handled by update-alternatives)
#!/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 / page-flip-corner.svg
Created November 17, 2017 16:39
SVG Graphic for lower right page turning, designed carefully by hand, keeping the SVG code as simple as possible
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paulwellnerbou
paulwellnerbou / ReloadablePropertiesTest.java
Last active February 1, 2018 09:25
Unit test demonstrating behaviour of apache commons configuration
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;
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;
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;