Skip to content

Instantly share code, notes, and snippets.

View tvlooy's full-sized avatar
🐧
<(o)

Tom Van Looy tvlooy

🐧
<(o)
View GitHub Profile
@neilk
neilk / vagrant-ssh-node
Created August 22, 2013 18:42
SSH into a Vagrant VM, such that Node.js can be debugged from a debugger or IDE in the host operating system. For some reason, port forwarding in the Vagrant file does not work. See https://groups.google.com/forum/#!topic/vagrant-up/RzPooJ0dp6Q
#!/bin/bash
# SSH into a Vagrant VM, forwarding ports in a way that allows node within Vagrant to be debugged by a debugger
# or IDE in the host operating system. Don't know why, but Vagrantfile port forwarding does not work.
# (https://groups.google.com/forum/#!topic/vagrant-up/RzPooJ0dp6Q)
/usr/bin/vagrant ssh-config > $TMPDIR/vagrant-ssh-config
ssh -F $TMPDIR/vagrant-ssh-config -L 5858:127.0.0.1:5858 default
rm $TMPDIR/vagrant-ssh-config
@jakzal
jakzal / behat-runner.sh
Last active June 7, 2016 01:24
Running behat scenarios parallelized (by sprint)
#!/usr/bin/env bash
# finds all sprint tags (like @sprint:42) and runs them in a reversed order (won't run not tagged scenarios)
PARALLEL_COMMAND='parallel --gnu'
#PARALLEL_COMMAND='xargs -I{}'
BEHAT_COMMAND='./bin/behat --ansi --tags={}'
grep '@sprint:' features/*.feature | sed -e 's/.*\(@sprint:[0-9]*\).*/\1/' | sort -ur | $PARALLEL_COMMAND $BEHAT_COMMAND
@ToJans
ToJans / InventoryItems.hs
Last active January 19, 2024 10:47
Haskell implementation of Greg Young's CQRS sample: https://github.com/gregoryyoung/m-r Love the sheer elegance of Haskell; no need for all that infrastructure crap
module InventoryItems(Command(..), Event(..), handle) where
import Data.Maybe(isJust)
type Id = String
type Name = String
type Amount = Int
data Command = CreateInventoryItem Id
| RenameInventoryItem Id Name
@JefClaes
JefClaes / gist:8975968
Last active August 29, 2015 13:56
Domain Event flavours
// Udi style w Static Domain Events
var dispatcher = new RecordingDomainEventsDispatcher();
DomainEvents.Dispatcher = dispatcher;
var customer = new Customer(new Address());
customer.Move(new Address());
Console.WriteLine("Customer moved: " + dispatcher.RecordedDomainEvent(new CustomerMoved()));
@namuol
namuol / INSTALL.md
Last active July 24, 2023 11:53
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

@umpirsky
umpirsky / list.md
Last active April 23, 2021 10:10
Symfony e-commerce solutions.
@Belphemur
Belphemur / build_nginx.sh
Last active November 13, 2022 13:05 — forked from MattWilcox/build_nginx.sh
Compiling Nginx with LibreSSL (and http2)
#!/usr/bin/env bash
# names of latest versions of each package
export NGINX_VERSION=1.15.5
export VERSION_NGINX=nginx-$NGINX_VERSION
export VERSION_LIBRESSL=libressl-2.8.1
export VERSION_PCRE=pcre-8.42
#export NPS_VERSION=1.9.32.10
#export VERSION_PAGESPEED=v${NPS_VERSION}-beta
@hsiboy
hsiboy / VBOX_E_INVALID_VM_STATE.md
Last active May 28, 2022 21:59
rescue a VM from VBOX_E_INVALID_OBJECT_STATE

Issue

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set forwarded ports...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
@abdullin
abdullin / ddd-in-golang.markdown
Last active October 10, 2023 00:46
DDD in golang

This is my response to an email asking about Domain-Driven Design in golang project.

Thank you for getting in touch. Below you will find my thoughts on how golang works with DDD, changing it. This is merely a perception of how things worked out for us in a single project.

That project has a relatively well-known domain. My colleagues on this project are very knowledgeable, thoughtful and invested in quality design. The story spelled out below is a result of countless hours spent discussing and refining the approach.

Conclusions could be very different, if there was a different project, team or a story-teller.

Short story

import Data.List (groupBy, sortBy)
getQuantity xs = let countQuantity acc (_, "registered") = succ acc
countQuantity acc (_, "sold") = pred acc
compareASC (i1, _) (i2, _)
| i1 < i2 = LT
| i1 > i2 = GT
| i1 == i2 = EQ
in map (foldl (countQuantity) 0) $ groupBy (\x y -> (fst x) == (fst y)) $ sortBy (compareASC) xs