Skip to content

Instantly share code, notes, and snippets.

View joergviola's full-sized avatar

Jörg Viola joergviola

View GitHub Profile
@joergviola
joergviola / Header.vue
Last active June 22, 2020 19:57
Very simple Vue state without Vuex
<template>
<div style="display: flex; justify-content: flex-start;">
{{ store.breadcrumb }}
</div>
</template>
<script>
import store from 'Store.js'
export default {
@joergviola
joergviola / Chat.java
Created October 20, 2012 13:58
Adding headers to Play Java async results
public static Result someAction() {
Promise<Result> promise = Akka.asPromise(....);
Promise<Result> modProm = applyHeader(promise);
return async(modProm);
}
private static Promise<Result> applyHeader(Promise<Result> promise) {
return promise.map(new Function<Result, Result>() {
@Override
@joergviola
joergviola / gist:3895052
Created October 15, 2012 20:11
Partially applied function in scala template
@(category:models.Category)
@defining(if(category==null) routes.RssController.feedAll(_:String) else routes.RssController.feed(_:String, category.id )) { rssUrl =>
<div id="newsFeedBlock">
<a href="@rssUrl("rss_2.0")" target="_blank">
<img id="newsFeedIcon" src="/assets/images/feed-icon-28x28.png" alt="NewsFeed" />
</a>
<div id="rssDetails" style="display: none;" />
Abonnieren als
@joergviola
joergviola / Red5Application.java
Created August 3, 2012 07:37
How to record high quality video in flash over slow connections
@Override
public void streamPublishStart(IBroadcastStream stream) {
super.streamPublishStart(stream);
try {
log.info("videorec start saving");
// Das ist ein ClientBroadcastStream
String name = stream.getPublishedName();
stream.saveAs(name, false);
String filename = stream.getSaveFilename();
IConnection conn = Red5.getConnectionLocal();
@joergviola
joergviola / Global.java
Created May 4, 2012 13:39
Basic Auth a whole Play 2.0 Application
public class Global extends GlobalSettings {
@Override
public Action onRequest(Request arg0, Method arg1) {
return new Action.Simple() {
public Result call(Context ctx) throws Throwable {
String authConf = Config.getString("basic.auth");
if (authConf == null)
return delegate.call(ctx);
String auth = ctx.request().getHeader("Authorization");