Skip to content

Instantly share code, notes, and snippets.

View trungk18's full-sized avatar
🇸🇬

Trung Vo trungk18

🇸🇬
View GitHub Profile
@trungk18
trungk18 / nx-structure-angular-nestjs.md
Last active November 3, 2023 02:25
Nx workspace structure for NestJS and Angular
View nx-structure-angular-nestjs.md

Nx

https://nx.dev/

Nx is a suite of powerful, extensible dev tools to help you architect, test, and build at any scale — integrating seamlessly with modern technologies and libraries while providing a robust CLI, caching, dependency management, and more.

It has first-class support for many frontend and backend technologies, so its documentation comes in multiple flavours.

Principles

@trungk18
trungk18 / checkboxes-single-page.ts
Last active March 11, 2021 03:54
Abstract class for handling selected items
View checkboxes-single-page.ts
export interface ICheckBoxModel {
checked: boolean;
}
export class CheckboxesSinglePageModel<T extends ICheckBoxModel> {
items: T[];
isSelectAll: boolean;
isIndeterminate: boolean;
constructor(items: T[], initialState = false) {
@trungk18
trungk18 / event-loop.md
Created January 4, 2021 12:16 — forked from jesstelford/event-loop.md
What is the JS Event Loop and Call Stack?
View event-loop.md

Regular Event Loop

This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)


Given the code

View ll-20.ts
import { ComponentFactoryResolver, ComponentRef, Directive, EventEmitter, Input, Type, ViewContainerRef } from '@angular/core';
import { Subscription } from 'rxjs';
@Directive({
selector: '[lazyComp]'
})
export class LazyCompDirective {
private _inputs;
private _outputs;
private subscription = new Subscription();
@trungk18
trungk18 / codersX-culture.md
Created June 18, 2020 02:58 — forked from nartc/codersX-culture.md
Văn hoá CodersX team
View codersX-culture.md

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

@trungk18
trungk18 / gist:e11965a61c9624265ca82769009e1d51
Created June 12, 2020 12:01 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
View gist:e11965a61c9624265ca82769009e1d51

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
View generateRecursiveObj.js
function generateRecursiveObj(input){
let output = {};
input.forEach(item => {
output[item.title] = {};
if(item.children && item.children.length){
output[item.title] = generateRecursiveObj(item.children);
}
})
return output;
}
@trungk18
trungk18 / youtube-vimeo-url-parser.js
Created February 3, 2019 07:49 — forked from yangshun/youtube-vimeo-url-parser.js
YouTube Vimeo URL Parser
View youtube-vimeo-url-parser.js
function parseVideo (url) {
// - Supported YouTube URL formats:
// - http://www.youtube.com/watch?v=My2FRPA3Gf8
// - http://youtu.be/My2FRPA3Gf8
// - https://youtube.googleapis.com/v/My2FRPA3Gf8
// - Supported Vimeo URL formats:
// - http://vimeo.com/25451551
// - http://player.vimeo.com/video/25451551
// - Also supports relative URLs:
// - //player.vimeo.com/video/25451551
@trungk18
trungk18 / any.component.html
Created December 18, 2018 09:57 — forked from arniebradfo/any.component.html
Angular *ngFor recursive list tree template
View any.component.html
<h1>Angular 2 Recursive List</h1>
<ul>
<ng-template #recursiveList let-list>
<li *ngFor="let item of list">
{{item.title}}
<ul *ngIf="item.children.length > 0">
<ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: item.children }"></ng-container>
</ul>
</li>
</ng-template>
@trungk18
trungk18 / passDataToAngular.md
Last active April 25, 2018 14:37
Pass data from MVC to Angular 2
View passDataToAngular.md

Index.cshtml

<my-angular-app appID="@Model.AppId">Loading...</my-angular-app> 

util.ts

//function to get the attribute value.
export function getAttribute(app: string, attributeName: string) {
 return document.getElementsByTagName(app)[0].getAttribute(attributeName);