Skip to content

Instantly share code, notes, and snippets.

View nartc's full-sized avatar
😁

Chau Tran nartc

😁
View GitHub Profile
@nartc
nartc / swagger
Created December 25, 2017 20:22
swagger.yaml
swagger: "2.0"
info:
version: "1.0.0"
title: HelpDeskTMF
description: HelpDeskTMF OpenAPI Documentations
host: localhost:3000
basePath: /
tags:
- name: Users
description: Users Routes
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "HelpDeskTMF",
"description": "HelpDeskTMF OpenAPI Documentations"
},
"host": "localhost:3000",
"basePath": "/",
"tags": [
import {Document, Model} from 'mongoose';
import {Request, Response} from 'express';
import {MongoError} from '../../../../Desktop/codewithcause/node_modules/@types/mongodb';
export class BaseController<U extends Document, T extends Model<U>> {
model: T;
constructor(_model: T) {
this.model = _model;
import {Document, Model} from 'mongoose';
import {Request, Response} from 'express';
import {MongoError} from '../../../../Desktop/codewithcause/node_modules/@types/mongodb';
export class BaseController<U extends Document, T extends Model<U>> {
model: T;
constructor(_model: T) {
this.model = _model;
export class UserController extends BaseController<IUser, User> {
userModel: User;
constructor(_userModel: User) {
super(_userModel);
this.userModel = _userModel;
}
// UserController will have the CRUD from BaseController, no need to write those here. But register() and login() is of different logic.
}
export class UserRouter {
router: Router;
userController: UserController;
userModel: User;
constructor() {
this.router = Router();
this.user = new User();
this.userController = new UserController(this.user);
this.routes();
import { Injectable } from '@angular/core';
import { JwtHelperService } from '@auth0/angular-jwt';
import { interval } from 'rxjs/internal/observable/interval';
import { of } from 'rxjs/internal/observable/of';
import { map, startWith, switchMap } from 'rxjs/operators';
import { Observable } from 'rxjs/Rx';
import { LoginResponseVm, LoginVm, SecurityClient } from '../app.api';
import { LocalStorageService } from './local-storage.service';
@Injectable({
@nartc
nartc / codersX-culture.md
Last active June 18, 2022 08:49 — forked from nhim175/codersX-culture.md
Văn hoá CodersX team

Văn hoá CodersX

CodersX là một. Chúng ta hoạt động vì một mục đích duy nhất: Thay đổi thế giới một cách tích cực, bắt đầu bằng việc tạo nên một nền giáo dục miễn phí.

Vision

  1. Thay đổi thế giới ← 2. Cùng nhau làm các startup có ảnh hưởng tích cực tới cuộc sống xung quanh ← 1. Làm mới hệ thống giáo dục ← 0. Giúp tất cả mọi người tiếp cận với lập trình

Giúp đỡ các thành viên trong team

Một team chỉ mạnh khi tất cả mọi người support lẫn nhau, và cùng nhau làm việc vì một mục tiêu duy nhất. Nếu chỉ nghĩ đến bản thân thì một lúc nào đó team sẽ tan rã (nếu nhiều người cùng nghĩ về bản thân), hoặc tự loại mình ra khỏi team.

Nghĩ tới người xung quanh

@nartc
nartc / useUsersFacade.ts
Created August 31, 2019 05:14
Revision of Thomas Burleson's React Hooks + Facade article on Medium: https://medium.com/p/4e116330bbe1
export function useUsersFacade(): [
UserState,
typeof usersService.setActive,
typeof usersService.updateActive
] {
const [users, setUsers] = useState<User[]>([]);
const [active, setActive] = useState<User | null>(null);
/**
* Manage subscriptions with auto-cleanup
@nartc
nartc / load-module.directive.ts
Created November 19, 2019 16:04
Angular - LazyLoad non-route Module Directive
import {
Compiler,
ComponentRef,
Directive,
Inject,
Injector,
Input,
NgModuleFactory,
OnInit,
Type,