Making Buttons On A Local Hugo Site To Edit The Files

September - 2020


I realized that doing streams is a lot like Rubber Duck Debugging. Talking to the stream makes you think through things the same way you would to the duck (or, you know, to someone else.)

Also, I don't really use it for debugging, but instead of a duck, I have a Memento Mori.

Notes from the stream:

  • Running PHP in MAMP, you can use this to launch a file in whatever editor it's defaulted to:
shell_exec('open /path/to/file/');
  • Here's the stuff I tried that didn't work:
	exec("'/Applications/Sublime' /Users/alans/woodshed/launchpad/html-prod");

	exec("python -c 'import os; os.system(\'/usr/local/bin/st\')'");

	$cmd = "python -c 'import os; os.system(\"open /Users/alans\")'";

	$cmd = 'open "/Applications/Sublime"';

	$cmd = "python -c 'import os; os.system(\"/usr/local/bin/st\")'";
	$cmd = '"/Applications/Sublime"';

	shell_exec('/bin/bash -c open .');	

Links from the stream:



This is a great piece of code from stackify that setups up so you can send php messages to the console.

function console_log($output, $with_script_tags = true) {
    $js_code = 'console.log(' . json_encode($output, JSON_HEX_TAG) . 
    if ($with_script_tags) {
        $js_code = '<script>' . $js_code . '</script>';
    echo $js_code;
  • The final thing is that I ended up using parse-url instead of split based on feedback in chat. It's good stuff: