Skip to content

Instantly share code, notes, and snippets.

View HerrNiklasRaab's full-sized avatar
🎯
Focusing

Niklas Raab HerrNiklasRaab

🎯
Focusing
View GitHub Profile
@HerrNiklasRaab
HerrNiklasRaab / instantdb-optional-field-shape.ts
Created May 21, 2026 20:48
InstantDB optional-field response shape — owner can't distinguish 'never written' from 'redacted' when the field has a perm rule
// Reproduces InstantDB's response shape for optional fields under different
// permission/value combinations. Run with:
//
// npm i @instantdb/admin
// INSTANTDB_APP_ID=... INSTANTDB_ADMIN_TOKEN=... npx tsx instantdb-optional-field-shape.ts
//
// The app must have the schema + perms below pushed first:
//
// npx instant-cli@latest push schema -p admin -a $INSTANTDB_APP_ID -y
// npx instant-cli@latest push perms -p admin -a $INSTANTDB_APP_ID -y
{
"pricePerShareInEuro": 500,
"noticePeriodInYears": 4,
"estimatedDividendPerYear": "1 - 3%",
"products": [
{
"name": "Junges Girokonto",
"priceGlsContribution": {
"billingPeriod": "yearly",
"pricePerBillingPeriodInEuro": 12
@HerrNiklasRaab
HerrNiklasRaab / user.dart
Created April 16, 2020 20:23
Boilerplate code serialization
class User extends Document {
final Name name;
final Address address;
final Gender gender;
final Birthday birthday;
final Email email;
final Weight weight;
final Length height;
final bool _hasFinishedSignUp;
final Iterable<Bike> myBikes;
abstract class User extends DataModel {
final Name name;
final Address address;
final Gender gender;
final Birthday birthDay;
final Email email;
final Weight weight;
final Length height;
final bool hasFinishedSignUp;