Skip to content

Instantly share code, notes, and snippets.

@davidsword
Last active March 12, 2019 18:09
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 davidsword/0aa554ff8fff8591609851c7237bb72f to your computer and use it in GitHub Desktop.
Save davidsword/0aa554ff8fff8591609851c7237bb72f to your computer and use it in GitHub Desktop.
PHP - part of an Alfred Workflow that changes a development url to production
<?php // don't actually use the php in workflow
// get the result of Apple Script action
$url = '{query}';
$a = ['http:','.loc']; // dev
$b = ['https:','.com']; // production
// identify if production and invert if so
if (strstr($url,$b[1]))
list($a,$b) = [$b,$a];
// the ol switcher'oo
$newurl = str_replace($a,$b,$url);
// give next action the new url
echo trim($newurl);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment