Houen's Blog

Thoughts on life, startups, tech & code

Git large rebase made simple, easy and painless

Git clutter

The large Git rebase

At my work we use a simple and clean workflow, for getting our code into production. We use Pull Requests for our branches, and rebase them so our history is nice and tight. This works very well 95% of the time. Branches are sufficiently small, turnaround is fast, and we have no problems. But, sometimes we still end up with something less than ideal. Luckily there is a nifty way of doing this. (more…)

Ruby Map Array to Hash (Also Rails)

Ruby Map Array to Hash

map-array-to-hash

Sometimes you need to map array value to a hash structure. It could be that you have a set of keys, and you want to map some values related to those keys to a hash in order to return it from a function. Or something else, what do I know. But I do know a nice, clean way to do it: (more…)

Format time and date in Java with SimpleDateFormat

Format time and date in JavaIt can be a chore to format time and date in Java. Sometimes you end up even trying to od it with a regular expression. This is a mistake, and will cause you a lot of headache. There is a much better way, using Java’s built in classes for Date and SimpleDateFormat. In this very short tutorial, I will show you how.

How to format time and date in Java

In Java, like in so many other programming languages, you often need to format time and date. This can be a hassle if you dont know the correct built-in classes for doing so. If you do, however, it becomes a breeze. (more…)

How to get current time in Java

I always forget how to get the current time in my timezone in Java. Here’s what I found to be the easiest way to do so:

Date now = Calendar.getInstance().getTime();

And if you want it in a different timezone:

Date now = Calendar.getInstance(TimeZone.getTimeZone("Europe/London")).getTime();

There it is. Super simple once you actually remember it 😀 Enjoy! (more…)

Get email about new posts

Get the latest posts delivered to your mailbox: