Skip to content

Instantly share code, notes, and snippets.

@anhkind
anhkind / rerender.directive.ts
Created August 5, 2021 08:56
Angular directive to re-render a template if it detects any changes of the input
/**
* Example:
*
* <ng-container *rerender='changingInput'>
* this content will be re-rendered everytime `changingInput` changes
* </ng-container>
*/
import { Directive,
Input,
@anhkind
anhkind / yardoc_cheatsheet.md
Created April 9, 2020 07:17 — forked from phansch/yardoc_cheatsheet.md
Improved YARD cheatsheet
@anhkind
anhkind / virtualbox.sh
Last active December 22, 2018 05:25
Settings of Virtualbox
# HOST
# make symlink work on shared folder (from: https://github.com/npm/npm/issues/992#issuecomment-174154202)
VM_NAME="Ubuntu"
SHARE_NAME="sf_dev"
VBoxManage setextradata "$VM_NAME" VBoxInternal2/SharedFoldersEnableSymlinksCreate/$SHARE_NAME 1
# check again
VBoxManage getextradata "$VM_NAME" enumerate
@anhkind
anhkind / upgrade.sh
Last active September 20, 2018 15:46
Upgrade Node and Yarn
brew upgrade node
brew upgrade yarn
yarn install --ignore-engines
@anhkind
anhkind / enable-camera2api.sh
Created August 22, 2018 08:10
Enable Camera2API
fastboot boot ~/Downloads/twrp-3.2.3-0-nitrogen.img
adb shell
setprop persist.camera.HAL3.enabled 1
setprop persist.camera.eis.enable 1
exit
@anhkind
anhkind / get-set.ts
Last active July 25, 2018 12:20
Typescript - get/set property
class User {
private _birthDate: string;
// can behave like a LAZY property
get birthDate(): string {
if (this._birthDate) {
return this._birthDate;
}
return this._birthDate = '1981-11-11';
DESCRIPTION TEXT COLOR
classic site classic green
PWA PWA red
API API blue
mobile mobile orange
unknown unknown gray
technical debt debt purple
chore chore purple
bug bug black
@anhkind
anhkind / upgrade-angular.sh
Last active April 18, 2018 10:26
Upgrade Angular
# from https://github.com/angular/angular-cli/issues/4391#issuecomment-277199786
# Fix global angular/cli
npm uninstall -g angular-cli
npm cache clean --force
npm install -g @angular/cli@latest
# Fix local angular/cli and angular
rm -rf node_modules dist
npm uninstall --save-dev angular-cli
@anhkind
anhkind / custom_outlet_nested_routes.ts
Last active July 10, 2017 12:33
nested routes of a custom outlet which use parent's template
// route definition
route = {
path: '',
component: CustomLayoutComponent,
outlet: 'custom',
children: [{
path: 'child-route',
component: ChildComponent
}]
}
@anhkind
anhkind / angular_vs_react.md
Last active May 1, 2017 06:06
Angular vs React resources