Skip to content

Instantly share code, notes, and snippets.

View trinhvanhuy's full-sized avatar
🚀

TRINH Van Huy trinhvanhuy

🚀
View GitHub Profile
@trinhvanhuy
trinhvanhuy / testcarmoov.js
Last active April 24, 2018 10:02
test carmoov
'use latest';
const request = require('request');
module.exports = function(context, cb, res) {
const nodemailer = require('nodemailer');
const smtpConfig = {
host: 'SSL0.OVH.NET',
port: 465,
secure: true,
auth: {
user: 'test@ant-tech.eu',
// All the mission that aren't being taken
let missionsQueue = [];
let currentTime = 0;
// Init list 50 masssageurs
let massageurs = [];
for (let i = 1; i <= 50; i++) {
massageurs.push({
index: i.toString(),
realIndex: i - 1,
availableAt: 0,
@trinhvanhuy
trinhvanhuy / testcontentsquare.ts
Last active May 11, 2018 08:08
testcontentsquare
const lib = {
'L': {
'N': 'W',
'E': 'N',
'S': 'E',
'W': 'S',
},
'R': {
'N': 'E',
'E': 'S',
@trinhvanhuy
trinhvanhuy / global.action.ts
Created January 15, 2019 09:58
Spinner Action
import { Action } from '@ngrx/store';
export enum GlobalActionTypes {
ShowSpinner = '[Global] showSpinner',
HideSpinner = '[Global] HideSpinner',
}
export class ShowSpinner implements Action {
readonly type = GlobalActionTypes.ShowSpinner;
constructor() {}
@trinhvanhuy
trinhvanhuy / global.reducer.ts
Created January 15, 2019 12:22
Spinner - Global Reducer
import { assign } from '@utils/reducer';
import {
GlobalActionTypes,
GlobalActionsUnion
} from '@app/core/actions/global.action';
export interface State {
spinnerCounter: number;
}
@trinhvanhuy
trinhvanhuy / index.ts
Created January 15, 2019 12:33
Spinner - State & selector
import {
ActionReducerMap,
createSelector,
createFeatureSelector,
ActionReducer,
MetaReducer,
} from '@ngrx/store';
import { environment } from '@environments/environment';
import { storeFreeze } from 'ngrx-store-freeze';
import * as fromGlobal from '@reducers/gloabal.reducer';
@trinhvanhuy
trinhvanhuy / loader.service.ts
Created January 15, 2019 12:40
Spinner - Loader Service
import { Injectable } from '@angular/core';
import * as globalAction from '@actions/global.action';
import * as fromRoot from '@core/reducers';
import { Store } from '@ngrx/store';
@Injectable({
providedIn: 'root'
})
export class LoaderService {
@trinhvanhuy
trinhvanhuy / loadderInterceptor.service.ts
Created January 15, 2019 12:45
Spinner - Interceptor Service
import { Injectable } from '@angular/core';
import {
HttpClient,
HttpHeaders,
HttpParams,
HttpParameterCodec
} from '@angular/common/http';
import { Observable } from 'rxjs';
import { LoaderService } from '@services/loader.service';
import {
@trinhvanhuy
trinhvanhuy / app.component.html
Created January 15, 2019 12:52
Spinner - Application
<div *ngIf="isShowSpinner" class="spinner-container"><img src="./assets/spinner.gif" /></div>
<div
style="
height: 100%;
"
>
<router-outlet></router-outlet>
<app-modal-container></app-modal-container>
</div>
@trinhvanhuy
trinhvanhuy / app.component.ts
Created January 15, 2019 12:57
Spinner - Application
import { Component, OnInit, AfterViewInit } from '@angular/core';
import { Angulartics2Piwik } from 'angulartics2/piwik';$
import { LoaderService } from '@services/loader.service';
import * as fromRoot from '@core/reducers';
import { Store } from '@ngrx/store';
import * as fromGlobal from '@actions/global.action';
import { Subscription } from 'rxjs';
import { OnDestroy } from '@angular/core';