Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Running Event Modeling sessions

Adam Dymitruk adymitruk

💭
Running Event Modeling sessions
View GitHub Profile
@adymitruk
adymitruk / conways-game-of-life.fish
Last active Apr 28, 2020
Conway's game of life in fishshell
View conways-game-of-life.fish
set DEAD " "; set LIVE "🌱"; set wid 21; set hei 21
for cell in b(seq 2)r(seq $hei)c(seq $wid); set -g $cell $DEAD; end
set -g flip 1; set -g flop 2
function show_board
for row in (seq $hei); for col in (seq $wid); set -l cell b{$flip}r{$row}c{$col}; echo -n $$cell
end; echo; end; end
set b1r10c10 $LIVE; set b1r10c11 $LIVE; set b1r10c12 $LIVE;
set b1r11c10 $LIVE; set b1r11c12 $LIVE;
set b1r12c10 $LIVE; set b1r12c11 $LIVE; set b1r12c12 $LIVE;
while true
@adymitruk
adymitruk / eventstore.cs
Last active Jan 6, 2021
simple event store in #0tech c#
View eventstore.cs
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Text;
using System.Threading;
using System.Xml;
using System.Xml.Serialization;
using System.Linq;
using domain;
@adymitruk
adymitruk / trello-cqrs-es.fish
Last active Nov 30, 2020
Trello in CQRS/ES in fish shell
View trello-cqrs-es.fish
#set up the dir structure if it doesn't exist
set t ~/.trello; mkdir -p $t
function if_exist # we don't want to litter our code with ifs if a read model or events are not there yet. Return /dev/nul for empty
if test -e $t/$argv[1]; echo $t/$argv[1]; else; echo /dev/null; end
end
function list # provide lists from our tab delimited entries with filtering and line item numbers to make choices
set list $argv[1]; set column_to_show $argv[2]; set filter $argv[3]; set count 1
cat (if_exist $list) | grep -e "$filter\$" | while read line
set -l line_items (string split \t $line)
echo $count\) $line_items[$column_to_show]
View pre-receive
#!/bin/bash
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
# check if back merges are happening from important branches
echo "checking for bad branch names"
View storageTests
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using Messages;
using NUnit.Framework;
using Services;
using Test.SampleNamespace;
using TransactionStorage;
using System.Linq;
View dataaccess.js
var db = require('mongodb'),
server = new db.Server('alex.mongohq.com', 10053, {auto_reconnect: true}),
con = new db.Db('consentiment', server);
// callback: (err)
exports.connect = function(callback) {
con.open(function opened(err, db) {
if (err) return callback(err);
//return callback(false, db);
//return false;