Skip to content

Instantly share code, notes, and snippets.

View michaelmr's full-sized avatar

michaelm michaelmr

View GitHub Profile
@michaelmr
michaelmr / system_design_practices.md
Created June 11, 2025 16:27
system design practices for complementary rules.

Section 1: Core Philosophy - Visibility, Simplicity, and Change

Optimize for Visibility:

    All components and their dependencies must be explicit and easily identifiable at an appropriate level of abstraction.

    State and state changes should be simple to identify and modify.
@michaelmr
michaelmr / gist:414d53abfda57a50d53ef3580be910b7
Last active April 21, 2025 19:24
prompt diagrama mermaid
Aspectos a tener en cuenta para generar un diagrama Mermaid usando la sintaxis flowchart:
- Usa `flowchart LR` o `flowchart TD`.
- Asegúrate de usar una versión reciente de Mermaid (ej. v11.6.0 o superior).
- Define nodos con: `ID[Texto Etiqueta]`.
- **Importante:** Si el `Texto Etiqueta` contiene caracteres especiales como `()`, `[]`, `{}` o comillas, encierra **toda** la etiqueta entre comillas dobles: `ID["Texto con<br>(paréntesis)"]`.
- Prefiere etiquetas en una sola línea; usa `<br>` solo si es necesario y verifica que funcione.
- Define conexiones sin etiqueta con: `ID1 --> ID2`.
- Define conexiones con etiqueta usando: `ID1 -- "Texto Etiqueta<br>Con Salto" --> ID2`. Siempre usa comillas `""` para las etiquetas de conexión (obligatorio si hay espacios o `<br>`).
- Usa comentarios `%%` únicamente en líneas separadas, NUNCA en la misma línea después de código (`código %% comentario` -> MAL).
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Tiny Elm</title>
</head>
<body>
<button id="inc">+</button>
<div id="count">0</div>
const tinyelm = (init, update, output, debug = console.log) => {
let state = init;
output(state);
return (event) => {
debug("dispatching event " + JSON.stringify(event));
debug("cur state " + JSON.stringify(state));
state = update(event, state);
debug("output state " + JSON.stringify(state));
angular.module("groupmuse").service("BackButtonManager", function($rootScope, $ionicPlatform) {
var managedStates;
managedStates = [];
$rootScope.$on('$stateChangeSuccess', function(event, next) {
var state, _i, _j, _len, _len1, _results;
for (_i = 0, _len = managedStates.length; _i < _len; _i++) {
state = managedStates[_i];
if (state.enabled) {
state.unregisterCallback();
state.enabled = false;
@michaelmr
michaelmr / gist:e5604053aee63c574f1c
Last active August 29, 2015 14:18
Updated version for models and specification of inputs for some controllers
//Views conventions
views = [
login,
dashboard,
issues,
issue-detail
issue-map,
issue-client
]

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000