Skip to content

Instantly share code, notes, and snippets.

import React, { Component } from 'react'
import PT from 'prop-types'
import Field, { isTextInput } from './Field'
import { get } from 'lodash'
class Fields extends Component {
// componentDidMount() {
// const { fields } = this.props
// // since focus on fields doesn't work as expected
// // in react native we do an autofocus on mount instead
// // of passing the autofocus prop to the the text field
@RichardLindhout
RichardLindhout / FlowBlockFinder.tsx
Created November 30, 2019 13:18
Warning: Asynchronous triggered a user-blocking update that suspended.
import React, {
Suspense,
useState,
// @ts-ignore - useDeferredValue does not exist yet in types
useDeferredValue,
useCallback,
ChangeEvent,
} from 'react'
import TextField from '@material-ui/core/TextField'
import LinearProgress from '@material-ui/core/LinearProgress'
@RichardLindhout
RichardLindhout / gist:81a4b7592e5a53b22f841a3377a823c2
Created February 10, 2020 23:19
Closable modal scroll friendly React Native
import React, { useRef, useCallback } from 'react'
import {
View,
Keyboard,
Animated,
ScrollView,
TouchableWithoutFeedback,
StyleSheet,
} from 'react-native'
@RichardLindhout
RichardLindhout / index.css
Created May 27, 2020 19:36
Make create-react-app error screen react less irritating while developing but still viewable
body > iframe {
left: auto !important;
width: 50px !important;
right: 0 !important;
border-left: 2px solid red !important;
opacity: 0.6 !important;
transition: all 300ms;
}
body > iframe:hover {
width: 50% !important;
@RichardLindhout
RichardLindhout / config-overrides.js
Created May 28, 2020 18:55
Enable React-Fast-Refresh in Create React App
/* config-overrides.js */
const { override } = require('customize-cra')
const { addReactRefresh } = require('customize-cra-react-refresh')
module.exports = override(addReactRefresh())
@RichardLindhout
RichardLindhout / Run commands
Created May 28, 2020 18:57
Add React Fast Refresh to create-react-app
yarn add customize-cra customize-cra-react-refresh --dev
@RichardLindhout
RichardLindhout / CSGMesh.ts
Last active February 10, 2021 16:25
CSGMesh.ts fix bug in production
// ## License
//
// Copyright (c) 2011 Evan Wallace (http://madebyevan.com/), under the MIT license.
// THREE.js rework by thrax
//
// # class CSG
// Holds a binary space partition tree representing a 3D solid. Two solids can
// be combined using the `union()`, `subtract()`, and `intersect()` methods.
//
// Differences Copyright 2020-2021 Sean Bradley : https://sbcode.net/threejs/
@RichardLindhout
RichardLindhout / sns_ses.go
Last active May 27, 2021 10:16
Code from https://github.com/web-ridge/sns_ses - Amazon SQS (Message Queuing Service) golang convert and parse to json structs of notification-contents of the Amazon SNS message of the Amazon SES service (Amazon Simple Email Service) (// https://docs.aws.amazon.com/ses/latest/DeveloperGuide/notification-contents.html#top-level-json-object)
package sns_ses
import "time"
type NotificationType string
const (
NotificationTypeBounce NotificationType = "Bounce"
NotificationTypeComplaint NotificationType = "Complaint"
NotificationTypeDelivery NotificationType = "Delivery"