Skip to content

Instantly share code, notes, and snippets.

View vinhnhq's full-sized avatar

Vinh Nguyen vinhnhq

  • Viet Nam
  • 11:07 (UTC +07:00)
  • X @vinhnhq
View GitHub Profile
@vinhnhq
vinhnhq / connect.js
Created April 27, 2021 18:51 — forked from gaearon/connect.js
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
@vinhnhq
vinhnhq / pget.go
Created December 17, 2019 20:00 — forked from montanaflynn/pget.go
Bounded Parallel Get Requests in Golang
package main
import (
"fmt"
"net/http"
"sort"
"time"
)
// a struct to hold the result from each request including an index

Keybase proof

I hereby claim:

  • I am vinhnguyenhq on github.
  • I am vinhnhq (https://keybase.io/vinhnhq) on keybase.
  • I have a public key ASDQzW-CjjfCXO2A4hkewtwTqaGC2AmhDT2iFdhX4mgKPgo

To claim this, I am signing this object:

@vinhnhq
vinhnhq / canvas.js
Created July 17, 2019 04:49 — forked from JobLeonard/canvas.js
A react component that wraps and autosizes a canvas element
import React, {PropTypes} from 'react';
import { debounce } from 'lodash';
// A simple helper component, wrapping retina logic for canvas and
// auto-resizing the canvas to fill its parent container.
// To determine size/layout, we just use CSS on the div containing
// the Canvas component (we're using this with flexbox, for example).
// Expects a "paint" function that takes a "context" to draw on
// Whenever this component updates it will call this paint function
// to draw on the canvas. For convenience, pixel dimensions are stored
@vinhnhq
vinhnhq / cloudSettings
Last active June 30, 2021 10:45
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-06-30T10:45:13.020Z","extensionVersion":"v3.4.3"}