Skip to content

Instantly share code, notes, and snippets.

@majo44
majo44 / index.ts
Last active April 26, 2023 12:59
`resolve.extensionAlias` is not taking in account for the dynamic imports expressions evaluation
const x = 'a';
import(`./lazy-${x}.js`);
@majo44
majo44 / index.html
Last active November 12, 2021 13:03
Storeon substore scoped events
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>GistRun</title>
</head>
<body>
<script src="index.js" type="module"></script>
</body>
</html>
export class CorrelationId {
private _nextChildId = 0;
constructor(public readonly origin: string) {}
nextLevel(): CorrelationId {
const next = this.clone(this.toString());
this._nextChildId++;
return next;
}
protected clone(newCorrelationId: string): CorrelationId {
export class CorrelationId {
private _nextChildId = 0;
constructor(public readonly origin: string) {}
nextLevel(): CorrelationId {
const next = this.clone(this.toString());
this._nextChildId++;
return next;
}
protected clone(newCorrelationId: string): CorrelationId {
@majo44
majo44 / example.ts
Last active December 12, 2019 13:12
Angular modules vs simple functional modules
/////// ANGULAR
// app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { FeatureModule } from './feature.module.ts';
@NgModule({
declarations: [
@majo44
majo44 / attrs.js
Last active February 9, 2019 02:47
Experimental rendering engine
import { normalizeEventName } from './event.js'
/**
* Set of most popular simple attributes.
*/
const standardAttrs = {
class: true,
id: true,
type: true,
value: true
// TODO this will be removed after: https://github.com/angular/angular-cli/issues/8046
const replace = require('replace-in-file');
const filesToFix = [
{
files: 'node_modules/@angular/cli/models/webpack-configs/typescript.js',
from: [/\.ts\$/g, /\\.ts\)\$/],
to: ['.(ts|tsx)$', '\\.ts|\\.tsx)$']
},
{
@majo44
majo44 / 1index.html
Last active February 19, 2022 05:00
SAM (like) implementation by Proxy.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Proxy Sam ?</title>
</head>
<body>
<script>
/// UTILS CODE
@majo44
majo44 / index.html
Created August 5, 2015 14:26
Variables are not exported properly by tsc when -m systemjs
<!DOCTYPE html>
<html lang="en">
<head>
<script src="bower_components/system.js/dist/system.js"></script>
</head>
<body>
<script>
System.config({
baseURL: '.',
defaultJSExtensions: true