Skip to content

Instantly share code, notes, and snippets.

View principalweb's full-sized avatar
🏠
Working from home

Principal Angular, Ionic, React, React Native Engineer principalweb

🏠
Working from home
View GitHub Profile
@principalweb
principalweb / reducer.ts
Created August 4, 2020 00:56
Reducer sample
import { AssetState } from './asset.state';
import { AssetActions, AssetActionTypes, GetAllSuccess, GetSuccess, CreateSuccess, UpdateSuccess } from './asset.actions';
import { createFeatureSelector, createSelector } from '@ngrx/store';
import { AppState } from '../app.state';
const initialStates: AssetState = {
assets: [{
id: '1',
transformerName: 'xyz-123456789',
location: 'German',
@principalweb
principalweb / actions.ts
Created August 4, 2020 00:55
Action sample
import { Action } from '@ngrx/store';
import { Asset } from '../../core/models/asset/asset';
/**
* Enum for asset action types.
*/
export enum AssetActionTypes {
GetAll = '[asset] GetAll',
GetAllSuccess = '[asset] GetAll Success',
Get = '[asset] Get',
@principalweb
principalweb / effects.ts
Created August 4, 2020 00:53
Effects Sample
import { Injectable } from '@angular/core';
import { Action } from '@ngrx/store';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { Observable, of } from 'rxjs';
import { switchMap, map, catchError } from 'rxjs/operators';
import * as AssetActions from './asset.actions';
import { AssetService } from '../../core/service/asset.service';
import { Asset } from '../../core/models/asset/asset';
<md-input-container class="admin-form">
<input md-input placeholder="Block Title" nfNoSpaces [(ngModel)]="block.title" id="block-{{ block.id }}-input-name" name="title"
#title="ngModel">
<md-hint [ngStyle]="{'color': 'red'}" align="start" *ngIf="!title.valid && !title.pristine">Title is required.</md-hint>
</md-input-container>
Be sure to include ref to directive in module declarations array.
@principalweb
principalweb / npm modules for node(backend)
Created April 27, 2019 13:58
Node project npm modules
{
"name": "nickelled",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "NODE_ENV=development nodemon app.js",
"test": "NODE_ENV=test node_modules/.bin/jasmine-node spec/server/",
"debug": "NODE_ENV=development node debug app.js"
},
"devDependencies": {
@principalweb
principalweb / npm module(React)
Created April 27, 2019 13:57
React project NPM modules
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"dependencies": {
"awesome-bootstrap-checkbox": "^1.0.0",
"axios": "^0.18.0",
"bootstrap": "4.0.0-beta.2",
"calendar-base": "^0.3.0",
"classnames": "^2.2.5",
@principalweb
principalweb / npm modules(Angular)
Created April 27, 2019 13:54
Angular project package.json
{
"name": "lilypadv2",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "node server.js",
"build:dev": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build && gzipper --verbose ./dist && node version-update.js",
"build:prod": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --prod && node version-update.js",
"test": "ng test",
{
"name": "in-home-angular",
"short_name": "in-home-angular",
"theme_color": "#1976d2",
"background_color": "#fafafa",
"display": "standalone",
"scope": "/",
"start_url": "/",
"icons": [
{
{
"name": "in-home-angular",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",