Author: kjartan

A git alias for a more compact log

I love git. I love using the command line for git. I love the fact that the git bash window lets me run unix-style commands under windows, and I love the sense of clarity and control it gives me.

I also love the way I can set up aliases using a plethora of options for many of git’s commands. Take git log for instance; I find myself checking the logs for a repo quite often, but I’ve seldom had any use for most of the stuff that command prints out, so instead I’ve typically been using something like:

git log --oneline -5.

Today however, I added the following alias in my .gitconfig file:

[alias]
lg = log --format=\"%h:%<|(30) %an: %s\" -6

From now on, git lg will show something like the following, and only for the previous 6 commits:

ad082da: Author Name       : Added some code...
d5b9040: Author Name       : Debugged the bugs in the code
a412d77: Someone Else      : Added bugs.
ab8b15a: John Coder        : Implemented specified functionality.
54ad5d7: Per               : Did me some programming!
61b8c88: Montgomery Clift  : Adding more stuff

Now, I have a more compact log, with only the last few commits, and only the info I tend to be really interested in.

Did I mention that I really like git?

How to disable the visual debug toolbar for XAML in Visual Studio

I’ve had the pleasure of working with XAML lately. When running a XAML application from Visual Studio in debug mode, this nifty little toolbar is placed on top of windows:

While I have no doubt this can be useful, I often find it annoying too, so here’s how to remove it:

Open Tools and Options from the menu, and search for “Visual” in the top left corner. Remove the tick from the highlighted checkbox, and hey-presto, no more unwanted elements in your UI!

HSTS preload list: Pending Submission

So I finally got around to setting up headers for a 301 redirect HSTS for my site. What does that mean? It means that hopefully some time soon, chronology.no will be added to Chrome’s  HTTP Strict Transport Security (HSTS) preload list, i.e. it will be hardcoded into Chrome as being an HTTPS only site.

In simpler terms: From now on, you’ll only be able to access any resources under the domain chronology.no using https, i.e. with encryption and authentication.

Great! Now all I need is a little more content on my site!

PS: You can check if the submission has been accepted here.

Resharper templates for unit testing with NUnit

If you’ve ever done test driven development for (TDD) over an extended period of time, you’ll probably agree that writing the same boilerplate test-code over and over can be a hassle. I’m talking specifically about structures like the following:

[TestMethod]
public void SetUp(){ ... }

[TestMethod]
public void Should_Do_Something_Or_Other(){ ... }

[TestCase("input")]
public void Should_Get_Some_Info(string targetPerson){ ... }

 

Writing a large number of tests quickly is perhaps the primary defining characteristic of a TDD process, so being able to generate code like the above quickly is an obvious advantage. If you use Resharper, you can add your own code templates to help you achieve this.

Below you’ll find three templates that I’ve been using for some time now, along with a description of how you can set them up in Visual Studio in under a minute.

Resharper Live Template Editor

Resharper Live Template Editor

Continue reading