Skip to content

Instantly share code, notes, and snippets.

View mhevery's full-sized avatar

Miško Hevery mhevery

View GitHub Profile
@mhevery
mhevery / Zone.md
Last active March 30, 2022 11:54
TC39 Zone Proposal

Zone Motivation

Make writing asynchronous code easier by having a consistent way of propagating "context" across related asynchronous operations. Have the "context" be responsible for async-local-storage, allowing the execution before and after hooks, and "context"-local error handling. Finally make sure that the "context"s are composable.

This feature needs to be part of the platform so that library and framework authors can relay on a common well know API, otherwise adoption will be limited.

/**
* Zone is a mechanism for intercepting and keeping track of asynchronous work.
*
* A Zone is a global object which is configured with rules about how to intercept and keep track
* of the asynchronous callbacks. Zone has these responsibilities:
*
* 1. Intercept asynchronous task scheduling
* 2. Wrap callbacks for error-handling and zone tracking across async operations.
* 3. Provide a way to attach data to zones
* 4. Provide a context specific last frame error handling
@mhevery
mhevery / microsyntax.md
Last active November 21, 2022 09:53
Angular microsyntax gramar

Microsyntax

Microsyntax in Angular allows you to write <div *ngFor="let item of items">{{item}}</div> instead of <ng-template ngFor [ngForOf]="items"><div>{{item}}</div></ng-template.

Constraints

The microsyntax must:

  • be know ahead of time so that IDEs can parse it without knowing what is the underlying semantics of the directive or what directives are present.
  • must translate to key-value attributes in the DOM.
# Overview
Github has a feature where the reviewer can suggest inline edits to a PR in side of a comment.
This is super usefull feature. PR owner can than accept these changes by accepting the suggestions and merging
them into the PR directly from the UI.
@mhevery
mhevery / LandingPage.builder.tsx
Last active May 19, 2022 03:14
Value of Builder.io Slides
export function LandingPage() {
return (
<>
<div class="hero">
<img src="./hero.jpg"/>
<span>10% SALE</span>
</div>
<ProductCard sku="MB002"/>
</>
);