Skip to content

Instantly share code, notes, and snippets.

@jacqui
Created May 10, 2012 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacqui/2656532 to your computer and use it in GitHub Desktop.
Save jacqui/2656532 to your computer and use it in GitHub Desktop.
switch current url to localhost:3000 (.nytimes.com version)
var url = window.location.href;
var matched = url.match(/http:\/\/(.*?)\//);
if (matched != null) {
var current_host = matched[1];
var local_url = url.replace(current_host, 'localhost.nytimes.com:3000');
window.location.href = local_url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment