Cory Knox

Fuel Injection? More Like Dependency Injection

Categories: learnings
Note 🔗This is part of a series of posts discussing Dependency Injection. It is aimed at explaining dependency injection in a way that non-technical users can understand, and will purposely gloss over some of the more advanced topics. Additional content in this series: Fuel Injection? More Like Dependency Injection I’ve been learning about dependency injection in .NET. Or, more accurately: I’ve been realizing that I already knew about dependency injection in .

New TIL tag and posts

Categories: learnings
Tags: TIL
For a while at Chocolatey, we have had a Slack channel for things we learned. For almost as long I have been meaning to add a post about the things I learned to my blog. Recently, Julia Evans shared about her creation of a small “TIL” section on her site. With that in mind, I have created a “TIL” tag on my blog, as well as redirecting https://coryknox.dev/til to the listing page for the tag.

Automatically setup remote tracking branch

Categories: learnings
Tags: TIL
I learned this on CSharpFritz’s stream: git config --global --add --bool push.autoSetupRemote true. This allows you to be able to just do git push and it’ll automatically setup a remote tracking branch on your default remote.

Prevent force pushing even when remote is fetched automatically

Categories: learnings
Tags: TIL
Today I learned from Scott Chacon about the --force-if-includes on git push. When used alongside --force-with-lease will negate the troubles potentially caused by applications that periodically git fetch for you. Basically it will prevent you from pushing if you’re pushing to a remote that has a commit that is not a common ancestor of what you’re pushing I think… If my testing is correct, then it’ll act like --force-with-lease when the remote has not been fetched down, but in the scenario where it has actually been fetched down.

Stash untracked changes in a way that git stash reports them

Categories: learnings
Tags: TIL
I’ve learned that you can do git stash -u to stash untracked files as well as tracked files… But nothing will show you those files in the stash by default… Instead, if you do git add <untracked files> and then git stash, they are magically tracked files even if they’re not actually committed to the repository.

Run PowerShell no matter what

Categories: learnings
VS Code is pretty amazing. Having the ability to edit virtually all of your files, and launch debugging sessions of them. But what if you have a codebase that has a .vscode/launch.json file and want to debug a PowerShell script? Unfortunately, by default, F5 will only debug PowerShell if there are no debugger configurations. This means that pressing F5 will attempt to run the configured debugger for your workspace regardless of if you’re in a PowerShell file.