Skip to content

Instantly share code, notes, and snippets.

View mhevery's full-sized avatar

Miško Hevery mhevery

View GitHub Profile
mhevery / LandingPage.builder.tsx
Last active May 19, 2022 03:14
Value of Slides
export function LandingPage() {
return (
<div class="hero">
<img src="./hero.jpg"/>
<span>10% SALE</span>
<ProductCard sku="MB002"/>
# 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 /
Last active November 21, 2022 09:53
Angular microsyntax gramar


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.


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.
* 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 /
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.

mhevery /
Last active July 27, 2017 09:08
TC39 Zone API Proposal

Monkey patching common browser APIs

Here is an example of how browser APIs could be patched to take advantage of Zone propagation.


Ideally we would not need to do this, since the browser would do this for us.

window.setTimeout = ((delegate) => {
mhevery / example.ts
Last active June 1, 2017 08:06
Angular2: NgProbe Design
/// <reference path="probe.d.ts" />
var appRef: ApplicationRef = ng.platform.applications[0];
curl > ~/Downloads/;
echo Fetched new dart version $(unzip -p ~/Downloads/ dart/dart-sdk/version)
rm -rf /Applications/dart-dev ;
unzip ~/Downloads/ -d /tmp > /dev/null
mv /tmp/dart /Applications/dart-dev
curl > ~/Downloads/;
echo Fetched new dart version $(unzip -p ~/Downloads/ dart/dart-sdk/version)
rm -rf /Applications/dart ;
When you go to bleeding edge you should change to:
@NgController {
selector: '[ng-controller=AppointmentCtrl]',
publishAs: 'ctrl'
class AppointmentCtrl {
String appointmentText = '';
List appointments = [{'time': '08:00', 'title': 'Wake Up'}];
mhevery / angular-issue-1051.html
Created June 13, 2012 18:37
<html ng-app>
<script type="text/javascript" src=""></script>
function Test($scope, $location) {
$scope.away = 'away';
<body ng-controller="Test">