Skip to content

Instantly share code, notes, and snippets.

@mknabe
mknabe / README.md
Created March 21, 2016 16:14
Set up ssh proxy for Stg
  1. Run the following shell script
  2. Open System Preferences
  3. Click Advanced...
  4. Go to the Proxies tab
  5. Select SOCKS Proxy
  6. Enter 127.0.0.1 as the host and 2001 as the port
  7. You'll need to add the necessary IPs to your hosts file

There are also instructions in the following article for setting this up just in Firefox

@mknabe
mknabe / README.md
Last active September 18, 2021 09:14
React component to warn users about unsaved changes to forms when they attempt navigate away from the page using redux-form

Use with the following

  • react-router
  • redux-form

You must use this compontent on the route component where the form is shown not on the form component itself. This is because this.props.route is only added to route components, and I didn't want to pass that down through props.

Inspired by this Codepad

Feedback appreciated

@mknabe
mknabe / test.js
Last active April 27, 2018 07:24
React testing
/*
Call a component method
https://github.com/airbnb/enzyme/issues/208#issuecomment-187313486
*/
const wrapper = shallow(<Button />); wrapper.instance().handleClick();
/*
Re-render component after calling setState
https://github.com/airbnb/enzyme/issues/450#issuecomment-225075145