Skip to content

Instantly share code, notes, and snippets.

View Daniel-Sogbey's full-sized avatar
🌍
Learning

Daniel Sogbey Daniel-Sogbey

🌍
Learning
View GitHub Profile
func TestChain(t *testing.T) {
used := ""
mw1 := func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
used += "1"
next.ServeHTTP(w, r)
})
}
@hartzis
hartzis / ImageUploadComponent.jsx
Last active April 3, 2023 18:09
React Image Upload with Preview
// https://codepen.io/hartzis/pen/VvNGZP
class ImageUpload extends Component {
constructor(props) {
super(props);
this.state = {
file: '',
imagePreviewUrl: ''
};
this._handleImageChange = this._handleImageChange.bind(this);
this._handleSubmit = this._handleSubmit.bind(this);