Skip to content

Instantly share code, notes, and snippets.

View alanxone's full-sized avatar
🎯
Focusing

Alan alanxone

🎯
Focusing
View GitHub Profile
@alanxone
alanxone / .gitignore
Created June 30, 2023 04:31 — forked from pdxjohnny/.gitignore
Setting Up k3s for Serverless (knative) on a $5 DigitalOcean Droplet Using k3d
.terraform/
*.pem
*.tf
*.tfstate
*.yaml
*.backup
istio-*/
cert-manager-*/
*.swp
env
@alanxone
alanxone / ngrx-example-module.ts
Last active May 5, 2020 01:03
NGRX Tutorial - Module
// NGRX Complete Tutorial Without Pain (Angular6 / RxJS6)
// https://medium.com/@andrew.kao/ngrx-complete-tutorial-without-pain-angular6-rxjs6-5511b8cb8dac
import { CommonModule } from '@angular/common';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { StoreModule } from '@ngrx/store';
import { reducers } from '(team main reducer -> the index.ts)';
@alanxone
alanxone / ngrx-example-routes.ts
Last active June 11, 2018 09:03
NGRX Tutorial - Routes
// NGRX Complete Tutorial Without Pain (Angular6 / RxJS6)
// https://medium.com/@andrew.kao/ngrx-complete-tutorial-without-pain-angular6-rxjs6-5511b8cb8dac
import { Routes } from '@angular/router';
import { AuthGuard } from '(auth guard path)';
export const routes: Routes = [
{
path: 'team',
loadChildren: '(Team App module)',
@alanxone
alanxone / ngrx-example-auth-guard.ts
Last active May 11, 2021 23:45
NGRX Tutorial - Auth Guard
// NGRX Complete Tutorial Without Pain (Angular6 / RxJS6)
// https://medium.com/@andrew.kao/ngrx-complete-tutorial-without-pain-angular6-rxjs6-5511b8cb8dac
import { Injectable } from '@angular/core';
import { CanActivate } from '@angular/router';
import { Store, select } from '@ngrx/store';
import { Observable } from 'rxjs';
import { map, take } from 'rxjs/operators';
import * as Auth from '(auth actions)';
import * as fromTeam from '(team main reducer)';
@alanxone
alanxone / ngrx-example-auth-component.ts
Last active June 11, 2018 09:03
NGRX Tutorial - Auth Component
// NGRX Complete Tutorial Without Pain (Angular6 / RxJS6)
// https://medium.com/@andrew.kao/ngrx-complete-tutorial-without-pain-angular6-rxjs6-5511b8cb8dac
import { Component, OnInit } from '@angular/core';
import { Authentication } from '(authentication model)';
import * as fromTeam from '(team main reducers)';
import * as Auth from '(auth actions)';
import { Store, select } from '@ngrx/store';
@alanxone
alanxone / ngrx-example-auth-services.ts
Last active June 11, 2018 09:04
NGRX Tutorial - Auth Service
// NGRX Complete Tutorial Without Pain (Angular6 / RxJS6)
// https://medium.com/@andrew.kao/ngrx-complete-tutorial-without-pain-angular6-rxjs6-5511b8cb8dac
import { Injectable } from '@angular/core';
import { of, Observable, throwError } from 'rxjs';
import { Authentication } from '(authentication model)';
@Injectable()
export class AuthService {
constructor() {}
@alanxone
alanxone / ngrx-example-auth-effects.ts
Last active June 11, 2018 09:04
NGRX Tutorial - Auth Effect
// NGRX Complete Tutorial Without Pain (Angular6 / RxJS6)
// https://medium.com/@andrew.kao/ngrx-complete-tutorial-without-pain-angular6-rxjs6-5511b8cb8dac
import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { tap, map, exhaustMap, catchError } from 'rxjs/operators';
import { Router } from '@angular/router';
import { of } from 'rxjs';
import { AuthService } from '(service path to request backend data)';
import { Permission } from '(service path to request backend data)';
@alanxone
alanxone / ngrx-example-index-reducer.ts
Last active June 11, 2018 09:04
NGRX Tutorial - Index Reducer
// NGRX Complete Tutorial Without Pain (Angular6 / RxJS6)
// https://medium.com/@andrew.kao/ngrx-complete-tutorial-without-pain-angular6-rxjs6-5511b8cb8dac
import {
createSelector,
createFeatureSelector,
ActionReducerMap,
} from '@ngrx/store';
@alanxone
alanxone / ngrx-example-auth-reducer.ts
Last active June 11, 2018 09:05
NGRX Tutorial - Auth Reducers
// NGRX Complete Tutorial Without Pain (Angular6 / RxJS6)
// https://medium.com/@andrew.kao/ngrx-complete-tutorial-without-pain-angular6-rxjs6-5511b8cb8dac
import { ActionReducer, Action } from '@ngrx/store';
import * as auth from '(auth action path)';
// Here is the final state required by the app
export interface State {
isAuthenticated: boolean;
// Name is what we passed in "Actions" as payload, thus it can be a model if needed
@alanxone
alanxone / ngrx-example-authentication-model.ts
Last active June 11, 2018 09:05
NGRX Tutorial - Authentication Model
// NGRX Complete Tutorial Without Pain (Angular6 / RxJS6)
// https://medium.com/@andrew.kao/ngrx-complete-tutorial-without-pain-angular6-rxjs6-5511b8cb8dac
export interface Authentication {
identifier: string;
password: string;
}