Skip to content

Instantly share code, notes, and snippets.

@knalli
knalli / OraclePhysicalNamingStrategy.java
Created July 12, 2015 13:44
Hibernate 5 PhysicalNamingStrategy (untested), Java8
package de.knallisworld.hibernate5;
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
import org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
import java.util.Optional;
import java.util.StringTokenizer;
@knalli
knalli / wrapper.babel.js
Last active August 29, 2015 14:17
angular-vertxbus ES6 Comparsion
"use strict";
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = pr

Keybase proof

I hereby claim:

  • I am knalli on github.
  • I am knalli (https://keybase.io/knalli) on keybase.
  • I have a public key whose fingerprint is FB6E 9E11 33CF E897 C89D E96B 6164 C7B3 B2F2 2D50

To claim this, I am signing this object:

@knalli
knalli / gist:bdebd651a0adab2da457
Created July 29, 2014 19:52
OS X & Java: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
# Sometimes some Java applications will not work because the internal references to the trusted libs are broken.
# Unless '/System/Library/Java/Support/CoreDeploy.bundle/Contents/Home/lib/security' does not exist, this should help
$ sudo mkdir -p /System/Library/Java/Support/CoreDeploy.bundle/Contents/Home/lib/security
$ cd /System/Library/Java/Support/CoreDeploy.bundle/Contents/Home/lib/security
$ sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/security/cacerts
$ sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/security/blacklist
$ sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/security/trusted.libraries
@knalli
knalli / package.json
Created March 11, 2014 14:41
Given a raw mail content `mail.raw`, this decodes and extracts the html part and writes it into `mail.output.html`.
{
"name": "extract-html-from-raw-mail",
"version": "1.0.0",
"main": "parse.js",
"dependencies": {
"mailparser": "~0.4.1"
},
"author": "knalli <knallisworld@googlemail.com>",
"license": "MIT"
}
@Service
public interface MyGateway {
@Gateway
Response handle(@Payload Request request);
}
@Service("api")
public class ApiImpl {
public Response handle(Request request) {
// Do some stuff and return a response object
}
}
@knalli
knalli / Config.java
Created February 5, 2014 20:04
Spring Integration 3 + Jackson 2 + Joda mappings
@Configuration
public class Config {
@Bean
public JsonObjectMapper<?> jsonObjectMapper() {
final ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JodaModule());
return new Jackson2JsonObjectMapper(mapper);
}
@knalli
knalli / IntegrationConfig.java
Created February 5, 2014 15:09
Spring Integration migration from 2.x to 3.x: Change Jackson1 to Jackson2, incl. Joda support
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.joda.JodaModule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.integration.support.json.Jackson2JsonObjectMapper;
import org.springframework.integration.support.json.JsonObjectMapper;
@Configuration
public class IntegrationConfig {
@knalli
knalli / index.coffee
Last active January 4, 2016 20:49
Semver (http://semver.org/) is only a promise. And this is the nerdy showcase. :)
maybe = ->
console.log 'Maybe?'
require('./semver-is-a-promise')(require('./package.json')).then(maybe)