Skip to content

Instantly share code, notes, and snippets.

View manzanit0's full-sized avatar

Javier García manzanit0

View GitHub Profile
@manzanit0
manzanit0 / tortilla.md
Created July 7, 2020 10:27
Tortilla recipe

Ingredients​

  • 0.5L Extra Virgin Olive Oil, Spanish not Italian :-)

  • 4 Big Potatoes (1kg aprox.)

  • 1 big onion

  • 6 large eggs

@manzanit0
manzanit0 / ci-simple.yaml
Last active October 11, 2023 20:24
Elixir CI with Github Actions
on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]
env:
MIX_ENV: test
jobs:
@manzanit0
manzanit0 / server.exs
Created June 1, 2021 09:56
HTTP Server in elixir w/ shebang
#!/usr/bin/env elixir
Mix.install([
{:plug_cowboy, "~> 2.5"}
])
defmodule Router do
use Plug.Router
plug(Plug.Logger)
plug(:match)
@manzanit0
manzanit0 / usecases.ts
Created November 1, 2021 18:16
Lightweight polymorphism in Typescript
interface UseCase {
isValid(): boolean;
handle(): void;
}
const runUsecase = (usecase: UseCase) => {
if (usecase.isValid()) {
usecase.handle();
}
};
@manzanit0
manzanit0 / paved-road-netflix.md
Last active February 3, 2022 16:32
The paved paas to microservices at Netflix

The paved paas to microservices at Netflix

TLDR

  • Key goals: velocity and reliability
  • Mean Time to Detect (MTTD) and Mean Time to Recovery (MTTR) are the key for reliability.
  • Consistency improves MTTD and MTTR, and therefor reliability.
  • Interoperability improves velocity.
  • A preassembled component needs to be flexible enough but convenient at the
@manzanit0
manzanit0 / notes.md
Last active April 16, 2022 09:38
Notes: SQL Antipatterns, by Bill Karwin

Notes: SQL Antipatterns, by Bill Karwin

Chapter 2: Jaywalking

TLDR: use constraints. They are your friends. If you push data validation to the application layer, the moment you add another consumer of the data (might be a manual script), you're in for a wild ride.

Chapter 3: Naive Trees

@manzanit0
manzanit0 / notes.md
Last active April 19, 2022 15:51
REST: I don't Think it Means What You Think it Does

REST: I don't Think it Means What You Think it Does

Talk: https://www.youtube.com/watch?v=pspy1H6A3FM

Def: An architectural style defined by the constraints Client-Server, Stateless Communications, Cachin, Uniform Interface, Layered System and (optionally) Code-on-demand.

Rest is perfectly defined. There is a set of rules that define it. If you follow them, it's REST, if not, then it's not.

@manzanit0
manzanit0 / .ideavimrc
Created April 21, 2022 14:53
Idea Vim Config
# Sources:
# https://gist.github.com/zchee/9c78f91cc5ad771c1f5d
# https://github.com/JetBrains/ideavim
let mapleader=";"
nnoremap <Leader>nc :e ~/.ideavimrc<CR>
nnoremap <Leader>nr :action IdeaVim.ReloadVimRc.reload<CR>
nnoremap <Leader>q :q<CR>
@manzanit0
manzanit0 / child_rows_as_json.sql
Last active August 22, 2022 09:47
Random bits and bobs when learning MySQL
-- This is simply an example of how to get child records as JSON.
--
SELECT ii.id AS invoice_id,
JSON_PRETTY(JSON_OBJECT('items',
(
SELECT
CAST(CONCAT('[',
GROUP_CONCAT(JSON_OBJECT(
'id', li.id,
'name', li.name,