Skip to content

Instantly share code, notes, and snippets.

View lacolaco's full-sized avatar

Suguru Inatomi lacolaco

View GitHub Profile
@lacolaco
lacolaco / 1.ngx-reactify.tsx
Last active February 26, 2024 08:13
A React component to render a standalone Angular component (Angular v14.2 is required)
import { ApplicationRef, ComponentRef, createComponent, Type } from "@angular/core";
import { createApplication } from "@angular/platform-browser";
import React, { useEffect, useRef, useState } from "react";
type AnyComponentRef = ComponentRef<unknown>;
export type ReactifyProps = {
component: Type<unknown>;
inputs?: Record<string, unknown>;
};
@lacolaco
lacolaco / virtual-file-system.ts
Created September 11, 2020 01:27
Angular Schematics Virtual FS for ts-morph
import { normalize, resolve } from '@angular-devkit/core';
import { Tree } from '@angular-devkit/schematics';
import { FileSystemHost } from 'ts-morph';
import * as ts from 'typescript';
export class VirtualFileSystem implements FileSystemHost {
constructor(private readonly tree: Tree, private readonly rootDir: string) {}
private resolvePath(filePath: string) {
return normalize(resolve(normalize(this.rootDir), normalize(filePath)));
@lacolaco
lacolaco / angular-tutorial-hands-on.md
Last active December 11, 2019 09:18
Angular Tutorial Hands-on (DevFest Tokyo 2019)

Angular Tutorial Hands-on

準備するもの

  • Google Chrome 最新版

https://angular.jp/start を使ってハンズオンを進めます。 ハンズオン中はインターネット接続を確保してください。

Step.1 はじめてのアプリ

@lacolaco
lacolaco / gist:ee088ce8db6416eddd5d8a37d3e86315
Created September 5, 2018 05:05
首狩りのメール
お世話になっております。
Futuretech Japanのマークと申します。
私どもは、国内のインターネットビジネス業界に特化したヘッドハンティング会社でございます。
人材サーチを行う中で、度々Si様のお名前を伺う機会があり、是非一度お話をさせていただきたく、ご連絡させていただいております。
現職には、ご満足されていらっしゃることと存じますが、
現在、転職市場では多くの経験を必要とする職種のニーズが高まっております。
私どもの特徴としては、現時点ご紹介できる案件の紹介だけでなく、事前にキャリアプランなどを伺い、
ご希望に沿った市場に出る前の案件をサーチし、転職のお手伝いをさせていただくことが多くございます。
お問い合わせ元 eichiiiworks_user <community@eichiiiworks.com>
お問い合わせ内容 Angular Japan User Groupコミュニティ
主催者様
はじめまして。エイチワークスの宮沢さくらと申します。
connpassのお問い合わせフォームから突然のメッセージを送りまして大変失礼致します。
大変失礼かと思いながらも、是非、Angular Japan User Group様のコミュニティ運営をぜひご支援させていただきたいと思い、ご連絡致しました。
@lacolaco
lacolaco / store.ts
Last active November 7, 2020 23:38
Simple Store with RxJS
import { distinctUntilChanged, map } from 'rxjs/operators';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
export abstract class Store<T> extends BehaviorSubject<T> {
constructor(initialState: T) {
super(initialState);
}
public dispatch(fn: (state: T) => T) {
this.next(fn(this.getValue()));
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": ["/favicon.ico", "/index.html"],
"versionedFiles": ["/*.bundle.css", "/*.bundle.js", "/*.chunk.js"]
}
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": ["/favicon.ico", "/index.html"],
"versionedFiles": ["/*.bundle.css", "/*.bundle.js", "/*.chunk.js"]
}
import { Component } from '@angular/core';
// Import SwUpdate from NGSW
import { SwUpdate } from '@angular/service-worker';
@Component({
selector: 'app-root',
template: `
...
`,
styles: []
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
// Import NGSW module
import { ServiceWorkerModule } from '@angular/service-worker';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent