Brief description - this is a Readme template you can reuse on your projects.
Table of Contents: (optional)
import * as React from "react"; | |
interface WordBreakProps { | |
value: string; | |
on?: string | string[] | RegExp; | |
} | |
/** | |
* Insert <wbr/> element into long text string according to matching rules | |
* |
/** | |
* Hook to create safe useReducer dispatch function | |
* | |
* This only runs a dispatch if the component is still mounted, otherwise it | |
* returns undefined to prevent memory leaks from async functions, for example. | |
*/ | |
const useSafeDispatch = <T>(dispatch: React.Dispatch<T>) => { | |
// The component is not rendered yet when hook is first called in the component logic | |
const isMounted = React.useRef(false); |
# Install Xcode Command Line Tools | |
xcode-select --install | |
# Install Homebrew | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" | |
brew update | |
# Test it out | |
brew cask install google-chrome | |
brew cask install firefox |
const WALTER_PRICE = 0.53; | |
const TARE_PRICE = 0.08; | |
function round(f) { | |
return Math.round(f*Math.pow(10,2))/Math.pow(10,2); | |
} | |
function getNumWalters(money) { | |
var ret = [0, 0]; | |
ret[0]=Math.floor(money/WALTER_PRICE); |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>buggy html</title> | |
<script> | |
const object = { nested: { state: 'before' } }; | |
// create a nested object |
getCountries() { | |
fetch('/api/endpoint/countries').then((data) => { | |
this.setState({ countries: data }); | |
}) | |
} | |
getCities(country) { | |
fetch(`/api/endpoint/countries/${country}/cities`).then((data) => { | |
this.setState({ cities: data }); |
// ./App.js | |
import React from 'react'; | |
import ComponentOne from './componentGroup/ComponentOne'; | |
import ComponentTwo from './componentGroup/ComponentTwo'; | |
class App extends React.Component { | |
render() { | |
return ( | |
<div> | |
<ComponentOne /> |
Brief description - this is a Readme template you can reuse on your projects.
Table of Contents: (optional)
/* | |
* Will flatten an array of arbitrarily nested arrays of any type into a flat array | |
* | |
* @param {array} array containing any type | |
* @return {array} flattened array | |
*/ | |
const nestedConcat = (array) => { | |
// flatten the first layer of arrays | |
const results = [].concat.apply([], array); | |
I hereby claim:
To claim this, I am signing this object: