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 / 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 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": {
<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 / 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';
@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 / 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',