Skip to content

Instantly share code, notes, and snippets.

@jinhduong
jinhduong / webhook.html
Last active June 27, 2018 15:50
Web hook
<script src="https://nt.codfee.xyz/embed/release/index.min.js"></script>
<script>
new __NotifyService({
key: '<your-key-herer>'
});
</script>
@jinhduong
jinhduong / rg.sql
Last active July 13, 2018 03:56
RG SQL
{"posts":[{"a":1,"b":2,"__id":"jgm1lltd"},{"a":4,"b":3,"__id":"jgm1mzv5"},{"a":10,"b":3,"__id":"jgm1we7z"}]}
@jinhduong
jinhduong / quill.js
Created November 23, 2017 10:56
Quill
import { Component, OnInit } from '@angular/core';
require('style-loader!./lib/quill.bubble.css');
require('style-loader!./lib/quill.snow.css');
@Component({
selector: 'app-agency-term',
templateUrl: './agency-term.component.html',
styleUrls: ['./agency-term.component.scss']
})
@jinhduong
jinhduong / reactiveform2.ts
Last active October 24, 2017 06:32
reactive2
form: FormGroup;
constructor(
private fb: FormBuilder
) { }
ngOnInit() {
this.form = this.fb.group({
type: [1, Validators.required],
house: ['',Validators.required],
@jinhduong
jinhduong / transaction.ts
Created July 12, 2017 15:36
transation-function
@LoadingIndicator()
checkTransaction(tran: Transaction) {
return this._checkoutService.checkBbsTransaction(tran)
.map(res => res.json())
.subscribe(res => {
if (AuthHelper.isLoggedIn()) {
this.router.navigate(['my-orders']);
} else {
this.message = tran.transactionId;
this.isSuccess = true;
@jinhduong
jinhduong / loading-indicator.ts
Last active July 12, 2017 15:38
Loading-indicator Decorators in Angular 2/4
export function LoadingIndicator(): MethodDecorator {
return function (target: Object, propertyKey: string | symbol, descriptor) {
const originalMethod = descriptor.value;
descriptor.value = function (...args) {
// Inject your show loading function HERE
const subs = originalMethod.apply(this, args);
// If it's using do operator
if (subs.subscribe) {