Skip to content

Instantly share code, notes, and snippets.

View davesnx's full-sized avatar

David Sancho davesnx

View GitHub Profile
@davesnx
davesnx / Makefile-help
Last active June 27, 2025 02:52
Print other makefiles commands as help
.PHONY: help # Set default action to be help!
help:
@echo "List of available make commands";
@echo "";
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}';
@echo "";
# Add double ## comments on the same line as the dependencies and will be printed out when running help
# Don't add them if you don't want to appear on help!
@hirrolot
hirrolot / CoC.ml
Last active December 30, 2025 06:47
Barebones lambda cube in OCaml
(* The syntax of our calculus. Notice that types are represented in the same way
as terms, which is the essence of CoC. *)
type term =
| Var of string
| Appl of term * term
| Binder of binder * string * term * term
| Star
| Box
and binder = Lam | Pi
```
OCaml compilation pipeline
┌────────────────┐
│ │
│ Source code │
@hirrolot
hirrolot / CoC.ml
Last active March 14, 2026 04:04
How to implement dependent types in 80 lines of code
type term =
| Lam of (term -> term)
| Pi of term * (term -> term)
| Appl of term * term
| Ann of term * term
| FreeVar of int
| Star
| Box
let unfurl lvl f = f (FreeVar lvl)
@davesnx
davesnx / index.md
Last active November 11, 2025 10:14
Safer Tailwind with OCaml-derived languages

Safer Tailwind with OCaml-derived languages (OCaml, Reason, ReScript or Melange)

Tailwind is optimised to work with JavaScript/TypeScript ecosystems, but other languages might have good integrations also.

This is the case for OCaml-derived languages that are used to do Frontend development. For the most part, a tighter integration might not be needed and using the Tailwind setup guide and regular classNames with strings is good enought.

let make = (~text) => {
 {React.string(text)}
@qexat
qexat / CT.md
Last active July 7, 2025 11:48
a simple type system with support for (co)cartesian types

Notes

(Co)Cartesian Types

Definitions

A cartesian type is a generalized type product where one inhabitant, called origin is common to all the types involved (called axes). A cocartesian type is a generalized type sum with a common origin to all axes.

That is, A * ... * Z is a cartesian type if there exists one inhabitant i common to every axis — i_A = i_B = ... = i_Z.

@steveruizok
steveruizok / clean-copy.md
Created December 7, 2025 22:03
Clean copy.

Reimplement the current branch on a new branch with a clean, narrative-quality git commit history suitable for reviewer comprehension.

Steps

  1. Validate the source branch

    • Ensure the current branch has no merge conflicts, uncommitted changes, or other issues.
    • Confirm it is up to date with main.
  2. Analyze the diff

  • Study all changes between the current branch and main.