How to add a custom XDebug Client menu to Sublime Text (on Mac)

Note, this works with this package: XDebug Client

Edit your Application Support/Sublime Text/Packages/User/Main.sublime-menu file and add the following to it:

[
    {
        "caption": "XDebug",
        "mnemonic": "X",
        "id": "xDebug",
        "children":
        [
            {
                "caption": "Continue",
                "command": "xdebug_continue"
            },
            {
                "caption": "Evaluate",
                "command": "xdebug_evaluate"
            },
            {
                "caption": "Restart",
                "command": "xdebugsessionrestart"
            },
            {
                "caption": "Stop",
                "command": "xdebugsessionstop"
            },
            {
                "caption": "Toggle Breakpoint",
                "command": "xdebug_breakpoint"
            },
            {
                "caption": "Clear All Breakpoints",
                "command": "xdebugclearall_breakpoints"
            },
            {
                "caption": "Start",
                "command": "xdebugsessionstart"
            }
        ]
    }
]

Now, at first all the menu items won’t show, but that’s because you haven’t started a debugging session. Just add a breakpoint and start a session to see all the other menu items.

I wish SublimeText had a API for adding buttons for these, but I think this is as good as it’s going to get!

See my configuration, as it may have been changed or improved.

Happy debugging!

How to run commands in a sub-shell and suppress output in the background that’s ZSH & shellcheck compatible

TL;DR: This works:

( (
    bar
    foo
) 1>&2>& & )

So, basically, what this does is run a sub-shell then bury your commands in another sub-shell and closes all STDOUT being reported and is sent to the background. I honestly am still not sure how this works!


&!

Because I use shellcheck with my zsh scripts, the following flagged an unknown error in shellcheck (because shellcheck does not support zsh at the moment) and it wouldn’t lint the file:

() (
    foo
    bar
) &> /dev/null &!

Specifically, it was the &! that wasn’t working (but is a valid ZSH directive to suppress background output). I would always get job output at the least using most of the suggestions, e.g., on Stack Exchange. So, I went down a Googling rabbit hole with no answers until I landed on:

https://www.baeldung.com/linux/run-multiple-commands-in-background

After navigating the formatting issues, I came up with the above Bash-compatible solution to run commands in the background with no output!

🙌

How to show all subtasks in Asana

Okay, so the problem is simple, and if you’re reading this you already know what it is: when you open a task with lots of subtasks you have to click Load more subtasks… every time…

Screenshot

That’s annoying, and Asana should change that. But, in the meantime, here’s what you can do to beat the system.

First, download (and pay; it’s worth it) WebCatalog and install Asana.

Screenshot

Once you do that you can run asana.com in a WebApp you can launch from your Applications. Sweet.

Now, the next part is simple. Go to the settings once you load the WebApp and go to Developers > JS Code Injection…

Gif

Add the below to the code section:

/**
 * Automatically Open Subtasks in Asana
 *
 * Note, if you use WebCatalog, just add this to the JS code
 * injection, it works.
 *
 * Also, this version checks for links to click indefinitely, vs how
 * the original only ran for 10 seconds.
 *
 * @see   https://forum.asana.com/t/allow-to-load-all-sub-tasks-at-once/43620/12
 */
(function () {
    window.setInterval(() => {
        let links = document.querySelectorAll('.SubtaskGrid-loadMore');

        if (links.length === 0) {
            return;
        }

        Array.from(links).map((link) => {
            link.click();
        });
    }, 2000);
})();

Restart the app, and now, when you pull up a task, by the time you scroll down to the section for more sub-tasks, it will have been expanded for you.

Image description

I would advise you to take a look at the rest of the settings in the App too, and I personally use Choosy to open asana.com URLs in my Webapp.

How to run your system PHP at 8.x & Laravel Valet at 7.x

Please see comments for some important updates!

Screenshot

Valet, when told to use a specific version of PHP (using valet use) symlinks $HOME/.config/valet/valet.sock (on macOS) to a specific version of PHP installed on your system. If you use valet use, unfortunately, it switches this symlink and your system PHP version.

But all you need to do is (with Homebrew) use brew unlink php && brew link php@8.1 --force --overwrite to tell your system to use PHP 8.1.x. That does not tell Valet what version to use; valet use does.

If you use, for example, valet use php@7.4, you can simply use brew unlink php && brew link php@8.1 --force --overwrite to re-link your system back to using PHP 8. If you look at $HOME/.config/valet/valet.sock, you will notice it’s still symlinked to valet74.sock, and you can confirm with, e.g., phpinfo().

It’s a bit of a hack, but it works for me.

Take a look at some aliases I have set up to make this easy with valet@7, which ensures my system continues to run 8.1.