Monthly Archives: December 2020

How much time do you spend coding ?

Time tracking is a pain when you have to do it for your boss, but it’s incredibly useful when you do it for you own projects, to find out what parts takes most of your time, how much time did you dedicate to this side project, etc.

For years I’ve been using Rescue time, I recently switched to https://wakatime.com, which is more programmer oriented. Its integration with VS Code (and most of the majors and not so majors IDEs) is great, and the reports really detailed.

Angular kanban component

While looking for some components to implement a kanban board, I found the @angular/cdk/drag-drop module, but I also stumbled upon this incredible work done by Trung Vo, a JIRA clone done in Angular : https://trungk18.com/experience/angular-jira-clone/, whose live demo can be seen here : https://jira.trungk18.com/project/board.

It’s so clean and neat, that you can’t help thinking “holy fuck,it’s open source ? I can use it even commercially ? I have to use it !”.

Exporting GIT history to a CSV/Excel file

There are many tools to compute stats from your GIT repositories, but sometimes, you may just want to export it to Excel and make your own quick and direty stats.

the git log command, with pretty print, is your friend. For example, the following command will display the commit date, hash, commiter name and email, and the commit message :

git log --pretty=format:%cI,%h,%an,%ae,%s > commits.csv

The pretty format documentation is available here : https://www.git-scm.com/docs/git-log#_pretty_formats

Mockito : how to mock method return value based on argument ?

When using mockito to mock some methods behaviour, you may want to change your mocked method return value based on an argument value.

This is not obvious, but quite simple to achieve, thanks to this SO post. The following example show how to mock a call to the myMethod() function by returning the first string parameter.

when(mockObject.myMethod(anyString()))
     .thenAnswer(invocation -> invocation.getArgument(0, String.class));