Skip to content

Instantly share code, notes, and snippets.


Mike Bild MikeBild

View GitHub Profile
MikeBild / event-sourced.js
Created Oct 25, 2016
Event-Source with Event-Log persistence with RxJS
View event-sourced.js
const fs = require('fs');
const Rx = require('rx');
const RxNode = require('rx-node');
const timerStream = new Rx.Subject();
const initialState = {count: 0};
const updateState = (state, msg) => {
return state;
MikeBild / cpu-bound.js
Last active Oct 25, 2016
Node.js - CPU bound operations with Rx
View cpu-bound.js
const RxNode = require('rx-node');
const Rx = require('rx');
const spawn = require('child_process').spawn;
RxNode.fromStream(spawn('find', ['/','-type','f','-exec', 'cat', '{}', '\+']).stdout)
.map(x => x.toString())
// using python
.map(x => RxNode.fromStream(spawn('./', [x]).stdout))
// or using javascript
//.map(x => RxNode.fromStream(spawn('./word-count.js', [x]).stdout))
View archive.tpl-ejs.html
<!doctype html>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>Mike Bild - Archive</title>
<link rel="stylesheet" href="mikebild.css" type="text/css" />
<link rel="stylesheet" href="pygment_trac.css" type="text/css" />
View order-line.task.js
const request = require('request-promise');
state.orders = state.orders || [];
this.GET = getOrders;
this.POST = startOrderProcess;
this.DELETE = abortOrder;
if(!this[req.method]) return res.status(404).end();
this[req.method](req.params, req.body);
MikeBild /
Last active Nov 1, 2016
Microservice Workflows mit Consumer-Driven-Contracts

Microservice Workflows mit Consumer-Driven-Contracts

Allen voran geht es mir um die Vereinfachung der Softwareentwicklung auch auf Systemebene. Ich meine die folgenden Artikel zeigen zumindest mittel- und langfristig genau das Gegenteil und sind ein gutes Beispiel ausufernder Systemlandschaften durch selbstverschuldet aufgesetzte Komplexität.

Wer Microservice richtig richtig macht, braucht keine Workflow Engine, kein BPMN, kein ESB, kein Message Broker, keine Aktor-Modelle und Frameworks, keine Enterprise Application Server, kein Event-Sourcin

MikeBild / async-either-with-promise.js
Last active Nov 10, 2018
Async Railway Oriented Programming in JS
View async-either-with-promise.js
#!/bin/env node
//thx to
.then(result =>, i) => `Person ${i+1}: ${person.cost || ''}${person.reasons.join(' ')}`))
.then(result => console.log(`Person entries\n${result.join('\n')}`));
View jquery.couch.longpoll.js
# jquery.couch.longpoll.js #
A handler that can be used to listen to changes from a CouchDB database,
using long-polling.
This seemed to be a bit simpler than using continuous polling, which I
was unable to get working with jQuery.
MikeBild / gist:031e88dd5af0d5c9f9b2
Created Jan 8, 2015
Mocha integration tests example
View gist:031e88dd5af0d5c9f9b2
'use strict';
var assert = require('assert'),
restify = require('restify');
var client = restify.createJsonClient({
version: '*',
rejectUnauthorized: false,
url: '',
headers: {'x-auth-token':'66LOHAiB8Zeod1bAeLYW'}
MikeBild / tryGetWithPromise.js
Last active Aug 29, 2015
AngularJS tryGet(url)
View tryGetWithPromise.js
<!doctype html>
<html data-ng-app="myApp">
<meta charset="utf-8">
<title>Try Get</title>
<script src=""></script>
<body data-ng-controller="demoCtrl">