Skip to content

Instantly share code, notes, and snippets.

View wildlingjill's full-sized avatar

Jill Robinson wildlingjill

View GitHub Profile
@markwoon
markwoon / Debounced.js
Created November 2, 2017 16:28
Debouncing in React
clase Foo extends React.Component {
componentWillUnmount = () => {
// make sure debounced method gets cancelled
this.method.cancel();
};
method = debounce(() => {
...
}, 100);
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"