Skip to content

Instantly share code, notes, and snippets.

Avatar

Felix Kuestahler talfco

View GitHub Profile
View test.java
protected String cleanupHTML(String elem) {
Whitelist list = Whitelist.basicWithImages();
list.addTags("div");
list.addEnforcedAttribute("a", "rel", "nofollow");
list.addAttributes(":all","style");
String doc = Jsoup.clean(elem, list);
logger.debug("Jsoup.clean: "+doc);
Document xmlDoc = Jsoup.parse(doc);
return cleanupStyle(xmlDoc);
}
@talfco
talfco / base_customer_globalFields.php
Created Feb 18, 2012
BP1: Global Fields Definition
View base_customer_globalFields.php
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/include/base.php');
// For each Business Object of the application (= $busobject) a global field
// variable is defined with contains meta information about each field
// which will be rendered in the content detail view as well as its form
// The file containing the definitions will be located in the frontend/coursetype
// directory
$busobject = "coursetype";
// First index is the flow on the form
$fields = array (
@talfco
talfco / scriptgen_base.php
Created Feb 19, 2012
BP1: Javascript Code Generator
View scriptgen_base.php
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/../common/cb.Global.php');
function generateInjectLocalizationScript($inForm) {
global $fields, $busobject;
echo "<script>";
echo "$(document).ready(function() {";
echo "var locfields = {";
foreach ($fields as $key => $value) {
echo '"label_' . $value["name"] . '": "' . $busobject . "." . $value["name"] . '",';
@talfco
talfco / CSVTestDataLoader.java
Created Jun 18, 2012
CSVTestLoader based on org.supercsv
View CSVTestDataLoader.java
package com.cloudburo.test;
import java.io.FileReader;
import java.util.List;
import java.util.ArrayList;
import org.supercsv.cellprocessor.ift.CellProcessor;
import org.supercsv.io.CsvBeanReader;
import org.supercsv.io.ICsvBeanReader;
import org.supercsv.prefs.CsvPreference;
@talfco
talfco / customers.csv
Created Jun 18, 2012
The Customers CSV File which gets loaded
View customers.csv
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
name;surname;address;plz;location;telephone;mobile;email;citizenship;birthdate
Küstahler;Felix;Zumikerstrasse;8700;Küsnacht;449123567;796249158;talfco@gmx.com;Swiss;27.05.1955
Meierhans;Albert;Bergstrasse 5;8706;Meilen;449123056;796329108;test@ggaweb.ch;USA;22.08.1996
@talfco
talfco / objectCreationByConfigString.coffee
Last active Dec 20, 2015
This is a cheatsheet for samples how to create objects dynamically
View objectCreationByConfigString.coffee
# Prerequisite there is a modelName.coffee class file in the corresponding folder
createObjectSample1 : (modelName) ->
new ( require "models/"+modelName)()
# This method only takes the className, supposing that require class loading took place
createObjectSample2: (strClass) ->
# Let's cache the Views
if window.cache[strClass] != undefined
log.debug("Approuter.newInstance: Reusing cached Instance "+strClass)
return window.cache[strClass]
View BlockstackIDGist
Verifying that "felixk.id" is my Blockstack ID. https://onename.com/felixk
@talfco
talfco / lesson-1
Created Jun 18, 2017
Example to fetch data from the football from the api.football-data.org API
View lesson-1
package net.cloudburo.football;
import org.apache.http.*;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
/**
A simple Java REST GET example using the Apache HTTP library.
View gist:547fe2a816c9a805825b3acd3ed91b0a
Verifying my Blockstack ID is secured with the address 171XBsDtyUCNtSxdqzPaBKjLE1EgwK1sqW https://explorer.blockstack.org/address/171XBsDtyUCNtSxdqzPaBKjLE1EgwK1sqW
@talfco
talfco / install-letsencrypt-in-jdk.sh
Last active Jun 3, 2018
A minimal adapted version of https://gist.github.com/Firefishy/109b0f1a90156f6c933a50fe40aa777e added x3 authority. Will add the letsencrypt certificates to the java jdk keystore cacerts
View install-letsencrypt-in-jdk.sh
set -e
KEYSTORE=$JAVA_HOME/jre/lib/security/cacerts
wget https://letsencrypt.org/certs/letsencryptauthorityx1.der
wget https://letsencrypt.org/certs/letsencryptauthorityx2.der
wget https://letsencrypt.org/certs/letsencryptauthorityx3.der
wget https://letsencrypt.org/certs/lets-encrypt-x1-cross-signed.der
wget https://letsencrypt.org/certs/lets-encrypt-x2-cross-signed.der
wget https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.der
You can’t perform that action at this time.