Skip to content

Instantly share code, notes, and snippets.

View cilindrox's full-sized avatar
💭
:suspect:

Gaston Festari cilindrox

💭
:suspect:
View GitHub Profile

Abstraction Suggestions

Summary: use good/established messaging patterns like Enterprise Integration Patterns. Don't make up your own. Don't expose transport implementation details to your application.

Broker

As much as possible, I prefer to hide Rabbit's implementation details from my application. In .Net we have a Broker abstraction that can communicate through a lot of different transports (rabbit just happens to be our preferred one). The broker allows us to expose a very simple API which is basically:

  • publish
  • request
  • start/stop subscription
@cilindrox
cilindrox / tmux-cheatsheet.markdown
Created July 1, 2016 13:38 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@cilindrox
cilindrox / postgres-cheatsheet.md
Created April 21, 2018 23:59 — forked from so0k/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

// link to "iw3mp.exe" +set dedicated 1 +set sv_punkbuster 1 +exec dedicated.cfg +map_rotate
// Put this file under CoD4/main install folder
set sv_hostname "chorilan"
// Security
set g_password ""
set rcon_password "changeMe!"
// Maximum Clients
@cilindrox
cilindrox / xgh.md
Last active August 22, 2018 15:59
eXtreme Go Horse

eXtreme Go Horse (XGH) Process

Source: [http://gohorseprocess.wordpress.com]

1. I think therefore it's not XGH.

In XGH you don't think, you do the first thing that comes to your mind. There's not a second option as the first one is faster.

2. There are 3 ways of solving a problem:

the right way, the wrong way and the XGH way which is exactly like the first one but faster. XGH is faster than any development process you know (see Axiom 14).

@cilindrox
cilindrox / balance.go
Created February 16, 2019 14:57
Local Load Balancer implementation in go
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build OMIT
package main
import (
"container/heap"
@cilindrox
cilindrox / style.css
Created April 13, 2019 20:28
style.css
body {
font-family: Liberation Sans, Arial, sans-serif;
background-color: #fffaf7;
line-height: 1.3;
}
main {
max-width: 70ch;
padding: 2ch;
margin: auto;
}
@cilindrox
cilindrox / zoom_fix.md
Created July 11, 2019 12:14 — forked from karanlyons/ZoomDaemon.yara
Fix for Unexpected Zoom Behavior

If you're using macOS, run these commands:

pkill "ZoomOpener"; rm -rf ~/.zoomus; touch ~/.zoomus && chmod 000 ~/.zoomus;
pkill "RingCentralOpener"; rm -rf ~/.ringcentralopener; touch ~/.ringcentralopener && chmod 000 ~/.ringcentralopener;

These two commands do the same thing for the two most popular "brands" of Zoom (Zoom, and RingCentral). They first kill the hidden server if it is running, and then regardless deletes it from its hidden directory if it exists there. Finally they create an empty file

@cilindrox
cilindrox / gist:cc8e112873a956b502777cb831e5f42f
Created March 30, 2020 14:22
Simple node.js code style tips to improve code quality

Whether you use 2 spaces or 4 spaces, there are a few simple things that can make your node.js code easier to read. We've been using them in all the hapi modules for over 4 years now to great results. This list is by no means complete but it highlights the most useful elements that will give you immediate value in reducing bugs.

Required modules

JavaScript makes it harder than most languages to know where variables are coming from. Variables assigned required modules are particularly important because they represent a singleton object shared with the entire application. There are also globals and module globals, along with function variables and arguments.

Traditionally, variables starting with an uppercase letter represent a class that must be instantiated using new. This was an important semantic in the early days of JavaScript but at this point, if you don't know Date requires new Date() you are probably very new. We have adopted Upper Camel Case variable names for all module global variables

@cilindrox
cilindrox / States-v3.md
Created June 29, 2020 19:49 — forked from andymatuschak/States-v3.md
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,