Skip to content

Instantly share code, notes, and snippets.

View swallentin's full-sized avatar

Stephan Wallentin swallentin

View GitHub Profile
@swallentin
swallentin / mattized.log
Created November 9, 2015 22:07
logdump
[2015-11-09 23:06:53.958] [DEBUG] app - b623e886-4e61-4fef-8b70-71e316eb91e6 ROUND_OVER ql-fra-02 #2 naked-ql
[2015-11-09 23:06:53.963] [DEBUG] app - b6808b6a-7f06-4e6d-8616-ef6f5ffd5b57 PLAYER_DEATH ql-fr-01 #5 #topdog.io
[2015-11-09 23:06:57.738] [DEBUG] app - 892bbf5e-36c3-4d48-81a0-c87936c7a902 PLAYER_DEATH ql-sth-01 #3 #topdog.io
[2015-11-09 23:06:59.520] [DEBUG] app - 6d41fffb-dfa6-4066-a07b-04008c13ff62 PLAYER_DEATH ql-fra-02 #1 naked-ql
[2015-11-09 23:06:59.522] [DEBUG] app - 6d41fffb-dfa6-4066-a07b-04008c13ff62 PLAYER_MEDAL ql-fra-02 #1 naked-ql
[2015-11-09 23:07:01.126] [DEBUG] app - e1576208-a55b-4a06-afb9-1b1720e7778c PLAYER_DEATH ql-ams-01 #5 #topdog.io
[2015-11-09 23:07:01.362] [DEBUG] app - 6d41fffb-dfa6-4066-a07b-04008c13ff62 PLAYER_MEDAL ql-fra-02 #1 naked-ql
[2015-11-09 23:07:01.523] [DEBUG] app - b6808b6a-7f06-4e6d-8616-ef6f5ffd5b57 PLAYER_MEDAL ql-fr-01 #5 #topdog.io
[2015-11-09 23:07:04.809] [DEBUG] app - b6808b6a-7f06-4e6d-8616-ef6f5ffd5b57 PLAYER_DEATH ql-fr-01 #5 #topdog.io
[2015-11-09
@swallentin
swallentin / onGameEvents.js
Last active November 7, 2015 12:57
How to subscribe to server events.
var StatsManager = require('./lib/StatsManager'),
statsManager = StatsManager.create(),
onServerEvent = function (data) {
console.log('Event type:', data.TYPE);
console.log('Server origin:', data.SERVER);
console.log('Message payload:', data.DATA)
};
statsManager.on('PLAYER_CONNECT', onServerEvent);
statsManager.on('PLAYER_DISCONNECT', onServerEvent);
var _ = require('lodash'),
events = require('events'),
inEventEmitter = new events.EventEmitter(),
localEventEmitter = new events.EventEmitter(),
outEventEmitter = new events.EventEmitter(),
jobs = [{
"name": "scrape",
"in": ":Editorial:ResearchLink:Added",
"out": ":Editorial:ResearchLink:Processed",
"states": [{
@swallentin
swallentin / kafka
Last active August 29, 2015 14:28 — forked from superscott/kafka
Simple Kafka Ubuntu init.d Startup Script
DAEMON_PATH=/opt/kafka/bin
DAEMON_NAME=kafka
# Check that networking is up.
#[ ${NETWORKING} = "no" ] && exit 0
PATH=$PATH:$DAEMON_PATH
# See how we were called.
case "$1" in
start)
@swallentin
swallentin / kafka-local-create-topic.sh
Last active September 22, 2015 13:20
KAFKA Management Snippers
kafka-topics.sh --create --topic mytopic --zookeeper localhost:2181 --partitions 1 --replication-factor 1
@swallentin
swallentin / ad.js
Created March 19, 2015 08:28
Async test
loadAd = function () {
console.log('loaded ad.');
};
@swallentin
swallentin / jquery.popup.js
Created September 19, 2014 13:40
jquery.popup plugin
/*!
* jQuery lightweight plugin boilerplate
* Original author: @ajpiano
* Further changes, comments: @addyosmani
* Licensed under the MIT license
*/
// the semi-colon before the function invocation is a safety
// net against concatenated scripts and/or other plugins
@swallentin
swallentin / include.xhtml
Created August 13, 2014 08:38
Sample of include using Java Server Pages - Facelets
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:fmt="http://payment.unibet.com/jsf/message">
<div class="#{cssClass}">
<h2>Include page</h2>
<p>Include page blah blah lorem ipsum</p>
<fmt:msg key="payment.euteller.depositHowLong.info" />
@swallentin
swallentin / broadcastEnrichmentService.js
Created October 14, 2013 13:13
updating broadcast.
(function () {
'use strict';
angular.module('admincms.broadcast')
.factory('broadcastEnrichmentService', function ($http, $q, $log, $resource, broadcastSettings, settings) {
var serviceEndPoint = [settings.adminApiBaseUrl, broadcastSettings.resourceEndPoints.broadcast, broadcastSettings.resourceEndPoints.enrichment].join(""),
paramsDefault = {
broadcastId: '@id',
enrichmentId: 'like-tv-se',
type: '@type'
@swallentin
swallentin / after.js
Last active December 23, 2015 06:09
Before: Callback function implementation that does not use guard return statements. After: Callback function implementation that uses guard return statements. Inspiration, http://www.bennadel.com/blog/2323-Use-A-Return-Statement-When-Invoking-Callbacks-Especially-In-A-Guard-Statement.htm
if (err) {
return callback(err);
}
if (!udfDocument) {
var msg = 'Could not find UDF document for importId: ' + udfId;
return callback(new Error(msg));
}
return callback(udfDocument);