Skip to content

Instantly share code, notes, and snippets.

View yubing24's full-sized avatar

Yubing Hou yubing24

View GitHub Profile
@yubing24
yubing24 / main.go
Last active April 20, 2018 04:58
DTO Mapper
package main
import (
"fmt"
"reflect"
"strings"
"time"
)
const dtotag = "dto"
@yubing24
yubing24 / gzip-json.go
Last active June 22, 2018 16:46
Pay attention to the type of returned json data, as well as gzip?
package main
import (
"bytes"
"compress/gzip"
"encoding/json"
"fmt"
"net/http"
"os"
)
type poloniexData struct {
@yubing24
yubing24 / account-minimal.component.html
Last active September 30, 2019 19:15
Side Navigation with Angular 6 and Material 2
<mat-toolbar color="accent">
<button mat-icon-button matTooltip="Application Menu" (click)="sidenav.toggle()">
<mat-icon>settings</mat-icon>
</button>
Account Settings
</mat-toolbar>
<mat-sidenav-container style="height: calc(100% - 64px); margin: 0;">
<mat-sidenav #sidenav mode="side" [class.mat-elevation-z4]="true" style="width: 240px">
</mat-sidenav>
<mat-sidenav-content>
@yubing24
yubing24 / app.module.ts
Last active August 9, 2018 16:05
Necessary modules for Angular Material Side Navigation
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import {AppComponent} from './app.component';
import {
MatButtonModule,
MatExpansionModule,
MatIconModule,
MatListModule,
MatMenuModule,
@yubing24
yubing24 / account-minimal.component.html
Created August 9, 2018 05:49
Skeleton code for Side Navigation
<mat-toolbar color="accent">
<button mat-icon-button matTooltip="Application Menu" (click)="sidenav.toggle()">
<mat-icon>settings</mat-icon>
</button>
Account Settings
</mat-toolbar>
<mat-sidenav-container style="height: calc(100% - 64px); margin: 0;">
<mat-sidenav #sidenav mode="side" [class.mat-elevation-z4]="true" style="width: 240px">
</mat-sidenav>
<mat-sidenav-content>
@yubing24
yubing24 / account.component.html
Created August 9, 2018 05:51
Angular Material Side Navigation with Expandable Menus
<mat-toolbar color="accent">
<button mat-icon-button matTooltip="Application Menu" (click)="sidenav.toggle()">
<mat-icon>settings</mat-icon>
</button>
Account Settings
<span style="flex: 1 1 auto;"></span>
<div>
<button mat-icon-button matTooltip="Switch Apps">
<mat-icon>apps</mat-icon>
</button>
@yubing24
yubing24 / template_method.go
Last active October 28, 2019 13:12
Template Method implementation using Go
package main
import "fmt"
type CommonInterface interface {
Create()
Destroy()
}
type ConcreteA struct {