Skip to content

Instantly share code, notes, and snippets.

@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) {
@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 / 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 / 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 / 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 / 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>
public partial class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: false, reloadOnChange: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
version: '3'
services:
staging.api:
build: .
ports:
- "5000:80"
environment:
- ASPNETCORE_ENVIRONMENT=Staging
production.api:
export const environment = {
production: true,
config: {
host: 'https://api.xxx.xxx/api'
// more config
}
};