Skip to content

Instantly share code, notes, and snippets.

View elledienne's full-sized avatar

Lorenzo De Nobili elledienne

View GitHub Profile
@elledienne
elledienne / zero.mdc
Last active April 7, 2025 16:09
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.
@elledienne
elledienne / action.yml
Created February 13, 2025 13:07
Zero cleanup action
# To be placed inside .github/actions like .github/actions/cleanup-pr/action.yml
name: "Cleanup PR Database Resources"
description: "Cleanup database resources for a specific PR"
inputs:
pr_number:
description: "PR number to cleanup"
required: true
pg_cluster_url:
version: "3.3"
services:
charts:
image: quay.io/mongodb/charts:v0.10.0
hostname: charts
ports:
# host:container port mapping. If you want MongoDB Charts to be
# reachable on a different port on the docker host, change this
# to <port>:80, e.g. 8888:80.
@elledienne
elledienne / cc_recursive_component.js
Last active May 13, 2019 15:22
[INTERVIEW] Coding challenge to test React, functional programming, context, class keyword
// Remember to overwite the code in CodeShare, JSFiddle, etc. to restore the inital state of the test and to avoid
// showing to candidates the changes made during other interwies
// TASKS:
// 1. Ask to developer to analyze the above React component:
// - The dev should be able read, understand and explain the component
// - The dev should be able to explain why it's necessary to .bind the method .addItem (and what other option we have: arrow function)
// - The dev should be able to understand that it's a functional component
// - The dev should be able to describe the behaviour of the component without rendering it
@elledienne
elledienne / cc_scope_iife.js
Last active May 13, 2019 15:21
[INTERVIEW] Coding challenge to test scope, ES6, IIFE
// Remember to overwite the code in CodeShare, JSFiddle, etc. to restore the inital state of the test and to avoid
// showing to candidates the changes made during other interwies
// TASKS:
// 1. Ask to developer to analyze the provide (broken) snippet:
// - The dev should be able to understand the intent of the snipped
// - The dev should be able to predict the (unexpected) behaviour
// - The dev should be able to provide at least one fix (and discuss about it)
const initialValues = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
@elledienne
elledienne / cc_functional_programming.js
Created June 26, 2017 21:34
[INTERVIEW] Coding challenge to test functional programming knowledge and generic JS skills
// Remember to overwite the code in CodeShare, JSFiddle, etc. to restore the inital state of the test and to avoid
// showing to candidates the changes made during other interwies
// TASKS:
// 1. Ask to developer to write a foreach function:
// - The dev should be familiar with .forEach/.each()
// - The dev should be familiar with the interface of these methods
// - The dev should be able to implement it (quite easy, see below for the implementation)
// 2. Ask to developer to write a map function:
// - The dev should be familiar with .map()
@elledienne
elledienne / cc_hoisting.js
Created June 26, 2017 21:00
[INTERVIEW] Coding challenge to test hoisting knowledge
// Remember to overwite the code in CodeShare, JSFiddle, etc. to restore the inital state of the test and to avoid
// showing to candidates the changes made during other interwies
// TASKS:
// 1. Ask to developer to go through the file and analyze it. The dev should:
// - Notice that the first comment return "undefined"
// - Notice that the second comment return "of Barcelona's weather"
// - Talk about hoisting
// - Identify what would happen if we would use "let" instead of "var" (ReferenceError: testVar is not defined)
@elledienne
elledienne / cc_scope.js
Last active May 13, 2019 15:21
[INTERVIEW] Coding challenge to test context, inheritance, string interpolation and destructuring
// Remember to overwite the code in CodeShare, JSFiddle, etc. to restore the inital state of the test and to avoid
// showing to candidates the changes made during other interwies
// TASKS:
// 1. Ask to developer to go through the file and analyze it. The dev should notice:
// - Constructor (at this point we can talk also about classes in ES6
// - Destructuring
// - String interpolation
// - Context (and should notice (and fix) that the callback passed to the onclick will log "I'm a button and I undefined" because it's not bound to
// the context ('dog')