Skip to content

Instantly share code, notes, and snippets.

@giltotherescue
Created January 22, 2013 00:14
Show Gist options
  • Save giltotherescue/4590824 to your computer and use it in GitHub Desktop.
Save giltotherescue/4590824 to your computer and use it in GitHub Desktop.
<?
preg_match_all("#[\"|']http://the.squidoocdn.com/(.+[\.v[\d]+]?\.css)[\"|']#", file_get_contents($argv[1]), $css);
print_r($css);
preg_match_all("#[\"|']http://the.squidoocdn.com/(.+[\.v[\d]+]?\.js)[\"|']#", file_get_contents($argv[1]), $js);
print_r($js);
@giltotherescue
Copy link
Author

This is a quick and dirty way to extract all static CSS and JS files from a Squidoo URL designated by a command line arg.

php static_test.php http://www.squidoo.com/gil

I am using it to test whether changes made to the versioning system result in changes to HTML output. The version numbers should be consistent. Here's how I use it:

  1. Deploy the new versioning system only to the old web1 server, which is no longer in production use.
  2. Edit my local "hosts" file and point www.squidoo.com to the old web1
  3. Run static_test.php on a URL
  4. Open up a new terminal tab, SSH to a remote server, install static_test.php, and run it on the same URL
  5. Flip the tabs back and forth to ensure the output matches exactly.
  6. Test a bunch of different URLs
  7. Manually tweak static-js on the old web1 server to ensure that a change to that file is reflected here.
  8. Profit

@collegeman
Copy link

Sounds great. The only thing I'd do differently is use diff instead of flipping back and forth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment