Skip to content

Instantly share code, notes, and snippets.

View danielcompton's full-sized avatar

Daniel Compton danielcompton

View GitHub Profile
@danielcompton
danielcompton / zero.mdc.md
Created April 7, 2025 00:10 — forked from elledienne/zero.mdc
Zero Custom Mutators MDC

Instructions for Using Zero Custom Mutators

Overview

Zero Custom Mutators provide a powerful mechanism for defining data write operations beyond simple CRUD. They allow you to embed arbitrary code within your write logic, running both client-side for optimistic updates and server-side for authority and complex operations.

Key Concepts:

  • Arbitrary Code: Mutators are functions, enabling complex validation, permissions, calling external services (like LLMs or sending emails), calling queue, etc.
  • Client-Side Execution: Mutators run immediately on the client for instant UI feedback.
(defn checkbox [short-name takes-place? word k]
^{:key (str k "takes-place")}
[:div.col.s2
[:input.filled-in {:type "checkbox"
:id (str "weekdays-" short-name)
:checked takes-place?}]
[:label.black-text {:for (str "weekdays-" short-name)
:style {:height "auto"
:line-height "normal"}}
word (when-not takes-place? (str " nicht" (when (= k :sun) ".")))]])