Skip to content

Instantly share code, notes, and snippets.

View sardaukar's full-sized avatar
:shipit:
Always be shipping

Bruno Antunes sardaukar

:shipit:
Always be shipping
View GitHub Profile
@stettix
stettix / things-i-believe.md
Last active March 20, 2024 17:45
Things I believe

Things I believe

This is a collection of the things I believe about software development. I have worked for years building backend and data processing systems, so read the below within that context.

Agree? Disagree? Feel free to let me know at @JanStette. See also my blog at www.janvsmachine.net.

Fundamentals

Keep it simple, stupid. You ain't gonna need it.

@tgodfrey
tgodfrey / redix.ex
Last active June 5, 2020 15:30
Elixir Module for working with MessageBus
defmodule MyApp.Redix do
@pool_size 5
# How long, in seconds, to keep messages in the backlog
@max_backlog_age 604800
# How many messages may be kept in the global backlog
@max_global_backlog_size 2000
# How many messages may be kep in the per-channel backlog
@max_backlog_size 1000
@slashdotdash
slashdotdash / README.md
Last active September 2, 2022 12:51
Commanded middleware to enrich commands during dispatch, such as calling an external API.

Commanded middleware for command enrichment

Usage

Add the EnrichCommand middleware to your command router:

defmodule MyApp.Router do
  use Commanded.Commands.Router
 
@matt-bailey
matt-bailey / github-pages-custom-domain-gandi-dns-records.md
Last active May 6, 2024 21:44
How to set up DNS records on gandi.net to use a custom domain on Github Pages

How to set up DNS records on gandi.net to use a custom domain on Github Pages

You would think it would be easy to find this information, but none of the Github or Gandi documentation is clear so I have recorded the required steps here.

Create the following A records:

@ 1800 IN A 185.199.108.153
@ 1800 IN A 185.199.109.153
@ 1800 IN A 185.199.110.153
// Clearly the best hello world out there.
#define _ATL_ATTRIBUTES 1
#define _WINDLL 1
#include <atlbase.h>
#include <atlcom.h>
#include <string.h>
#include <comdef.h>
#include <string>
#include <fstream>
#include <iostream>
@heemskerkerik
heemskerkerik / DispatchBenchmark.cs
Created November 24, 2017 10:21
Benchmark of different double dispatch methods in C#
// depends on BenchmarkDotNet 0.10.10
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using BenchmarkDotNet.Running;
anonymous
anonymous / RevDate.js
Created November 21, 2017 02:02
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var RevDate = function RevDate(dateparse) {
_classCallCheck(this, RevDate);
var moment = new Date();
if (typeof dateparse !== 'undefined') {
moment = new Date(dateparse);
@cblgh
cblgh / dat-quickstart.md
Last active May 1, 2018 19:29
make the p2p web with dat's primitives

low level primitives (in ascending abstraction)

  • hypercore works with individual posts in an append-only feed
  • hyperdrive abstracted filestore / works with files
  • hyperdiscovery create p2p swarms for hypercores, hyperdrives, and hyperdbs
  • hyperdb key-value database

higher level abstractions

  • webdb database; basically a document(?) store
  • dat-node built ontop of hypercore & hyperdrive, abstracts a bunch of stuff; less complex but also less flexible
@gonzofish
gonzofish / fizz_buzz.exs
Created April 29, 2017 12:56
Solving FizzBuzz without if in Elixir
fizz_word = fn
(0, 0, _) -> "FizzBuzz"
(0, _, _) -> "Fizz"
(_, 0, _) -> "Buzz"
(_, _, third) -> third
end
fizz_buzz = fn n -> fizz_word.(rem(n, 3), rem(n, 5), n) end

Shopping cart, Event Sourcing style

This is an example of how to interact with a shopping cart by emitting actions or events.

A processor object dispatches incoming events to susbcribers, who are in charge of mutating data (an order in this case).

Run a simple user session that interacts with the cart with

ruby user_session.rb