Skip to content

Instantly share code, notes, and snippets.

View talfco's full-sized avatar

Felix Kuestahler talfco

View GitHub Profile
@talfco
talfco / base_customer_globalFields.php
Created February 18, 2012 08:05
BP1: Global Fields Definition
<?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 February 19, 2012 00:31
BP1: Javascript Code Generator
<?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 June 18, 2012 18:19
CSVTestLoader based on org.supercsv
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 June 18, 2012 18:24
The Customers CSV File which gets loaded
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 December 20, 2015 05:38
This is a cheatsheet for samples how to create objects dynamically
# 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]
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);
}
Verifying that "felixk.id" is my Blockstack ID. https://onename.com/felixk
@talfco
talfco / lesson-1
Created June 18, 2017 07:20
Example to fetch data from the football from the api.football-data.org API
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.
@talfco
talfco / gist:547fe2a816c9a805825b3acd3ed91b0a
Created November 11, 2017 10:16
Blockstack Trust Check
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 June 3, 2018 12:42
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
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