Skip to content

Instantly share code, notes, and snippets.

@blambeau
blambeau / CLAUDE.md
Last active August 30, 2026 06:59
SKILL: functional-core-testing

Testing

Compute what to do, then do it — in two separate functions. Shape effectful work as fetch → decide → execute:

  • decide is pure (values in, a description of the work out),
  • execute just walks that description with no branching.

Unit-test the pure part with plain data in / plain data out; the shell is covered by integration tests. No mocks, stubs, spies or doubles — including collaborators injected only so tests can pass a fake. If you find yourself asserting that a method was called, split the function instead.

⏺ Here's a Tutorial D/Rel design for tracking book loans with a max 5 books per client constraint:
// Base relvars
VAR Client REAL RELATION {client_id INT, name CHAR} KEY {client_id};
VAR Book REAL RELATION {book_id INT, title CHAR} KEY {book_id};
VAR Loan REAL RELATION {client_id INT, book_id INT, loan_date DATE}
KEY {book_id} // A book can only be loaned to one client at a time
;
// Foreign key constraints

Method: micro spec agentic flow

We follow a micro spec approach where each development task is described as a short markdown card annotated with data in YAML front matter.

Workflow rules

  • ALWAYS work one card at a time.
  • ALWAYS finish the ongoing card(s) before working on another one.
  • If you plan something, write your plan to the card and mark it analyzed.
  • If you move a card from todo to ongoing, make sure to include your plan and to-do list within the card.

Prompt

Me: You wrote a Relation#toText(...) method to display Relations as nice ASCII tables. Are we sure it's working on nested relations ?

Claude: the unit tests pass !

Me (thinking): yes, but they just assert incomplete stuff.

Me: Can you write example/toText.ts and execute it for me, so I can see the output ?

@blambeau
blambeau / alice.html
Last active March 5, 2020 20:44
CSS layout exercice
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://gist.githubusercontent.com/DavidWells/18e73022e723037a50d6/raw/ead7e72d11c847ad9b81f094686543522101c278/reset.css" />
<style>
body {
margin: 10%;
}
.container {
border: 1px solid red;
<!doctype html>
<html lang="fr-BE">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Inscription Incroyables Comestibles - Sombreffe en Transition</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="icon" href="favicon.ico">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!--[if lt IE 9]>
@blambeau
blambeau / La Belgique à la COP24... en wel om te werken.md
Created December 11, 2018 07:56
La Belgique à la COP24... en wel om te werken!

België naar de COP24, en verder ...

We vragen de aandacht van

  • Charles Michel, Eerste Minister

  • Marie-Christine Marghem, Federale Minister van Energie, Leefmilieu en Duurzame Ontwikkeling

  • François Bellot, Federale Minister van Mobiliteit

Les couacs du vote électronique, un tremplin bienvenu pour vous parler de résilience

Au lendemain des élections communales, j'observe la vague verte s'écouler dans les quotidiens, et m'amuse de la voir partager l'actualité avec d'autres titres évoquant les (très attendus, j'y viens!) couacs du vote électronique.

A Bruxelles, quarante-sept bureaux de votes ont ouvert avec deux heures de retard ou plus, cinq n'ont semble-t-il jamais ouvert. A Wavre, au delà des files interminables constatées, c'est le décompte qui a été fortement perturbé par une panne d'électricité.

Je suis un professionnel du secteur informatique, en charge du développement et du monitoring de systèmes informatiques souvent complexes, docteur de l'UCL dans l'équipe d'ingénierie informatique et... ces problèmes ne m'étonnent aucunement. J'irai même plus loin: personne ne les règlera jamais, c'est comme cela. Cela vous étonne? Moi pas.

Comme je suis me récemment intéressé à la notion de résilience dans le cadre d'initiatives de transition

@blambeau
blambeau / gist:03e9c8239ce9818a45a8
Last active August 29, 2015 14:11
PostgreSQL and CTEs

Why doesn't PostgreSQL optimize Common Table Expressions?

PostgreSQL does not seem to optimize common table expressions (CTE) very well. At the same time, is seems to optimize properly when views are involved. Any idea why? Is that accidental or is it a technical/theoretical/essential reason? Examples below.

With CTE, restriction after join

Does not seem optimized.

sap=# explain with j as (select * from suppliers natural join shipments) select * from j where status > 20;
logger.configure({
default: "none",
override: {
"brolMachin": "all",
"trucBidule": "get"
}
});
customResource.get("brolMachin").then(function(result){
//