Friday, September 26, 2014

Beyond SOLID: The Dependency Elimination Principle
Last post I explained why I don't teach the SOLID design principles. Read the post for more detail, but the primary reason is that SOLID encourages heavy use of dependencies. Applying SOLID to a codebase for even a short time will yield dependencies on abstractions everywhere -- quickly producing a codebase that is unintelligible.

Friday, September 05, 2014

git cherry

My mnemonic for git cherry, i.e. git cherry upstream [head]

My quick understanding is that in many cases it means: show me everything that's NOT in upstream.

In other words:

git cherry branch-without-stuff branch-with-stuff


git cherry less-stuff more-stuff


git cherry present future


git cherry past present

So to see what's in develop but not yet in master, type this:

git cherry master develop

Which means, essentially, show me everything in develop that's not (yet) in master. 

Wednesday, August 20, 2014

Strongly-typed function callbacks in TypeScript

The question:
In TypeScript I can declare a parameter of a function as a type Function. Is there a "type-safe" way of doing this that I am missing?
My favorite answer: from Drew Noakes:
Here are TypeScript equivalents of some common .NET delegates:
interface Action<T>
    (item: T): void;

interface Func<T,TResult>
    (item: T): TResult;

Renaming a remote branch in Git

I don't quite understand this, but I'll post it here anyway. It comes from StackOverflow user sschuberth.

git push <remote> <remote>/<old_name>:refs/heads/<new_name> :<old_name>

git push origin origin/hotfix/Cant-load-assembly.0:refs/heads/feature/Fix-cant-load-assembly :hotfix/Cant-load-assembly.0


Friday, June 20, 2014

Git - Refreshing a repository after changing line endings

Who knew? My repositories sometimes contain problematic commits that are just about fixing up line endings, but here's a solution to that from GitHub. (I haven't tested it yet.)
Refreshing a repository after changing line endings
Here's the StackOverflow post from which GitHub gets their answer. There's also something interesting about removing the index, which I never knew about.
Trying to fix line-endings with git filter-branch, but having no luck

Thursday, April 10, 2014

Use Date Based File Archiving with NLog

My quick and dirty way of doing it. The target tag is the most relevant part if you're already using NLog.