Example of a more complicated EventStore projection using GitHub API data
EventStore L&L
- Download EventStore (Mono(SL) vs Windows)
- Running EventStore from the command-line (w/projections)
- Logging in to the UI
- Setting a default ACL (using curl)
| local M = {} | |
| local B = bit or bit32 or require("catppuccin.lib.native_bit") | |
| local hash_str = function(str) -- MurmurOAAT_32, https://stackoverflow.com/questions/7666509/hash-function-for-string | |
| local hash = 0x12345678 | |
| local tbl = { string.byte(str, 1, #str) } | |
| for i = 1, #tbl do | |
| hash = B.bxor(hash, tbl[i]) | |
| hash = hash * 0x5bd1e995 | |
| hash = B.bxor(hash, B.rshift(hash, 15)) |
| awk 'BEGIN{ | |
| s="/\\/\\/\\/\\/\\"; s=s s s s s s s s s s s s s s s s s s s s s s s; | |
| for (colnum = 0; colnum<256; colnum++) { | |
| r = 255-(colnum*255/255); | |
| g = (colnum*510/255); | |
| b = (colnum*255/255); | |
| if (g>255) g = 510-g; | |
| printf "\033[48;2;%d;%d;%dm", r,g,b; | |
| printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b; | |
| printf "%s\033[0m", substr(s,colnum+1,1); |
| # Push an IssuesEvent into ES (with known issue number) | |
| curl -i -L -d @example-issues-event.json http://127.0.0.1:2113/streams/github-IssuesEvent -H "Content-Type:application/json" -H "ES-EventType:IssuesEvent" -u "admin:changeit" | |
| # Push a PushEvent into ES (has a commit description with required match) | |
| curl -i -L -d @example-push-event.json http://127.0.0.1:2113/streams/github-PushEvent -H "Content-Type:application/json" -H "ES-EventType:PushEvent" -u "admin:changeit" | |
| # Push a DeploymentEvent into ES (has a description with required match) | |
| curl -i -L -d @example-DeploymentEvent-desc.json http://127.0.0.1:2113/streams/github-DeploymentEvent -H "Content-Type:application/json" -H "ES-EventType:DeploymentEvent" -u "admin:changeit" |
| { | |
| "$userStreamAcl" : { | |
| "$r" : "$all", | |
| "$w" : "$all", | |
| "$d" : "$all", | |
| "$mr" : "$all", | |
| "$mw" : "$all" | |
| }, | |
| "$systemStreamAcl" : { | |
| "$r" : "$admins", |
| var githubApi = require("node-github"); | |
| var http = require("http"); | |
| var timeUntilNextEvents = 10000; | |
| var last_created_at = new Date(); | |
| var overlapped = false; | |
| var uuid = (function() { | |
| var self = {}; | |
| var lut = []; for (var i=0; i<256; i++) { lut[i] = (i<16?'0':'')+(i).toString(16); } | |
| self.generate = function() { |
| var http = require('http'); | |
| var https = require('https'); | |
| var timeUntilNextEvents = 10000; | |
| var last_created_at = new Date(); | |
| var overlapped = false; | |
| var uuid = (function() { | |
| var self = {}; | |
| var lut = []; for (var i=0; i<256; i++) { lut[i] = (i<16?'0':'')+(i).toString(16); } | |
| self.generate = function() { |
Example of a more complicated EventStore projection using GitHub API data
| #!/bin/sh | |
| # This script will setup Evm (Emacs Version Manager) and Cask on | |
| # Travis to use for Emacs Lisp testing. | |
| # | |
| # In .travis.yml, add this: | |
| # | |
| # - curl -fsSkL https://gist.github.com/ianbattersby/c3399aa8cd9e2a6f8afa/raw > travis.sh && source ./travis.sh | |
| # | |
| # Emacs 24.3 is installed in the above script because Cask requires |
| [15200,07,15:26:50.939] Read Request Body Failed. | |
| Value cannot be null. | |
| Parameter name: token |
I hereby claim:
To claim this, I am signing this object: