Skip to content

Instantly share code, notes, and snippets.

:octocat:
Happy New Year!

Joe Jiang hijiangtao

:octocat:
Happy New Year!
Block or report user

Report or block hijiangtao

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hijiangtao
hijiangtao / movie.effects.ts
Created May 8, 2020
Demo of using @ngrx/effects to load data from http request
View movie.effects.ts
import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { EMPTY } from 'rxjs';
import { map, mergeMap, catchError } from 'rxjs/operators';
import { MoviesService } from './movies.service';
@Injectable()
export class MovieEffects {
loadMovies$ = createEffect(() => this.actions$.pipe(
@hijiangtao
hijiangtao / app-routing.module.ts
Created Jan 30, 2020
Angular ControlValueAccessor 介绍与实战代码
View app-routing.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { HelloPageComponent } from './pages/hello/hello.component';
const routes: Routes = [
{
path: 'hello',
pathMatch: 'full',
component: HelloPageComponent
@hijiangtao
hijiangtao / Child.ts
Created Jan 9, 2020
[Angular] ControlValueAccessor with formGroup data in child component
View Child.ts
import {Component, Input} from '@angular/core'
import {
FormControl,
FormGroup,
ControlValueAccessor,
NG_VALUE_ACCESSOR,
FormBuilder,
Validator
} from '@angular/forms';
@hijiangtao
hijiangtao / index.js
Created Dec 13, 2019
[BUG] Rax 小程序多次渲染间状态值更新错误问题
View index.js
/** @jsx createElement */
import { createElement, useEffect, useState } from 'rax';
import View from 'rax-view';
export default function App() {
const [stateParent, setStateParent] = useState(true);
const [stateChild, setStateChild] = useState(true);
useEffect(() => {
setStateChild(!stateChild);
@hijiangtao
hijiangtao / compose.js
Created Jul 6, 2019
Brief explanation of redux middleware's work internals
View compose.js
function compose(...funcs) {
if (funcs.length === 0) {
return arg => arg
}
if (funcs.length === 1) {
return funcs[0]
}
return funcs.reduce((a, b) => (...args) => a(b(...args)));
@hijiangtao
hijiangtao / data.js
Created Mar 17, 2019
Dynamic Web Worker Demo
View data.js
const BASE_DATASETS = {
airports: {
PKU: { lat: 1, lng: 1, key: 'OKU', count: 1 },
// ...
}
}
export default BASE_DATASETS;
@hijiangtao
hijiangtao / data.js
Created Mar 17, 2019
Dynamic Web Worker Demo
View data.js
const BASE_DATASETS = {
airports: {
PKU: { lat: 1, lng: 1, key: 'OKU', count: 1 },
// ...
}
}
export default BASE_DATASETS;
@hijiangtao
hijiangtao / app.js
Created Feb 27, 2019
react-map-gl onViewportChange not work when outer DeckGL has same type event listener
View app.js
/* global window */
import React, {Component} from 'react';
import {render} from 'react-dom';
import MapGL, {FlyToInterpolator} from 'react-map-gl';
import DeckGL, {ScatterplotLayer} from 'deck.gl';
import ControlPanel from './control-panel';
const MAPBOX_TOKEN = ''; // Set your mapbox token here
@hijiangtao
hijiangtao / index.dart
Last active Feb 15, 2019
Dart Language operator ~/ method example
View index.dart
// https://api.dartlang.org/stable/2.1.1/dart-core/num/operator_truncate_divide.html
void main() {
print(5~/3);
}
@hijiangtao
hijiangtao / index.js
Created Jan 29, 2019
mapbox-gl-language not work well inside react-map-gl
View index.js
import React, {Component} from 'react';
import {render} from 'react-dom';
import {StaticMap} from 'react-map-gl';
import MapboxLanguage from 'mapbox-gl-language';
export default class App extends Component {
state = {
viewport: {
longitude: -100,
You can’t perform that action at this time.