This is based on an email I send my .NET team at work
A few random links today.
Unclosed Tag Finder
This has saved me a few times when trying to find an unclosed HTML tag buried somewhere among a half dozen templates. You just paste in the markup and it will try to tell you what tag is broken.
Binary Tree Bin Packing Algorithm
I stumbled across this when I was looking into how some front-end build tools do automatic spriting. CSS spriting is a way of taking multiple source images and cramming them into one large image, then using CSS to adjust what part of that large image is actually visible. This can increase performance of a website by reducing HTTP requests for multiple images.
The naive approach is to just throw them all together linearly, but if the images are a bunch of different sizes, you wind up with a lot of wasted whitespace.
This article walks through how to use a binary tree to sort the source images in a way that makes it easier to fit snugly into a square output image with way less wasted space.
It also comes with a nice demo page .
I really like N-Fluent for writing unit test assertions in C#.
It plays really well with Intellisense, so that it has customized matchers based on the type of the object you are testing. For example, if its a
, Intellisense will prompt you with
or if its an
it has enumerable testing methods
I also like that it’s impossible to get the expected and actual backwards. In Nunit, Xunit, and MSTest, the assertions are always
. I frequently forget the right order. If you get it wrong, the test still passes/fails, but the error message becomes confusing.
It also has really nice error messages that quickly point you to the problem.