Skip to content

Instantly share code, notes, and snippets.

<FeatureTypeStyle>
<Rule>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>circle</WellKnownName>
<Fill>
<CssParameter name="fill">#FF0000</CssParameter>
</Fill>
</Mark>
@hnrchrdl
hnrchrdl / web.config
Last active April 5, 2018 08:10 — forked from KristofferBerge/web.config
Configuration file for Azure web app to support angular2 applications with routing and long urls for auth tokens and woff/woff2 files.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<httpRuntime maxQueryStringLength="32768" maxUrlLength="65536"/>
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxQueryString="32768"/>
</requestFiltering>
@hnrchrdl
hnrchrdl / create-react-app-flow-jest-vscode.md
Last active December 21, 2019 06:52
Create new Project with Create-React-App with Flow and VSCode support

1. Create new app

npx create-react-app myapp

2. Edit workspace settings in vscode for flow typechecking

{
  "flow.useNPMPackagedFlow": true,
 "javascript.validate.enable": false
  1. Install enzyme and enzyme react adapter
yarn add -D enzyme enzyme-react-adapter-react-16
  1. Create a file for test setup

Create a file src/setupTests.js. It will automatically get picked up by create-react-app. In this file, put code to run before Tests. for example, to configure enzyme, put this in:

=== install deps ===
sudo apt update
sudo apt install zsh fonts-powerline wget git
=== change default shell ===
chsh -s /bin/zsh
=== (optional) verify installation ===
which zsh -> 'usr/bin/zsh'
echo $SHELL -> 'usr/bin/zsh'
const App = () => {
const [counter, setCounter] = useState(0);
const [aboveFive, setAboveFive] = useState(false);
const increment = () => {
setCounter(n => n + 1);
};
useEffect(() => {
if (counter > 5) {
shouldComponentUpdate(prevProps) {
return prevProps.isAboveFive !== this.props.isAboveFive;
}
const Child = React.memo(({ isAboveFive, children }) => {
console.log("child renders");
return (
<>
<h2>Child: {!isAboveFive ? "<= 5" : "> 5"}</h2>
{children}
</>
);
});
const App = () => {
const [counter, setCounter] = useState(0);
const [aboveFive, setAboveFive] = useState(false);
const increment = () => {
setCounter(n => n + 1);
};
useEffect(() => {
if (counter > 5) {
const App = () => {
const [counter, setCounter] = useState(0);
const [aboveFive, setAboveFive] = useState(false);
const increment = () => {
setCounter(n => n + 1);
};
useEffect(() => {
if (counter > 5) {