Houen's Blog

Thoughts on life, startups, tech & code

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…)

Easy way to copy one git branch to another local branch

At my work we use a couple of branches for deployment with CodeShip. When we push one of our ‘build’ branches, Codeship automatically starts a new build on it, and deploys if all tests pass. One of these is our QA branch. For this reason it is beneficial for us to have a quick workflow to make one of these branches behave like a dev branch we want to test-deploy. I think I have now found the easiest, fastest Git command for doing so: (more…)

Dependency Injection makes your Ruby and Rails methods easier to test

I’ve read a lot about Dependency Injection in Ruby and Rails lately, and thought I would do a quick post to showcase how Dependency Injection can really help you with even small methods. Such as testing the common current_user method in the ApplicationController:

Here is a quite simple method to authorize the current user by an Auth-Token variable, for API authentication. (more…)

Linking WordPress and Google Plus

Linking WordPress and Google Plus is extremely easy once you know how, and can add wonderful value to your blog, by linking your readers closer to you, the author. I know sign off on my blog posts with my friendly face next to them, and hopefully this serves as a way to assure my readers that I sign off on what I write. No auto-generated content here, my friends!

Anyway Linking WP and Google is so easy. Let’s do it:

Linking WordPress and Google Plus in Four Easy Steps

Prerequisites: Almost none, but I am assuming you know how to install plugins in your wordpress blog, and already have a Google Plus profile.

Step one

Install and activate the plugin “Google Plus Authorship”

Screen Shot 2013-06-07 at 11.31.55 AM

Step two

Find your Google Plus profile URL. You will find it by going to http://plus.google.com, signing in, and then clicking the little arrow next to your picture. Out will pop a small menu where you can click “Show profile”. Clicking this will take you to your profile, and you can get your profile URL from the address bar. Mine is https://plus.google.com/115125376004755233882

Screen Shot 2013-06-07 at 11.38.52 AM

Step three

Go to your profile page (Users -> Your profile). There are two places to enter Google plus profile URL here. One under “Contact Info”, the other under “Google Plus profile information”. Add your profile URL to both.

Screen Shot 2013-06-07 at 11.54.59 AM Screen Shot 2013-06-07 at 11.55.05 AM

Step four

Now we need to add a link from your Google Plus profile to your blog. On your profile page (that you now know the URL for) click “About”

Screen Shot 2013-06-07 at 11.45.19 AM

 

On the “About” page, find the “Links” section, and click to edit it.

Screen Shot 2013-06-07 at 11.46.29 AM

 

Where it says “contributor to”, add a new custom link, linking to the front page of your blog.

Screen Shot 2013-06-07 at 11.47.59 AM

All done

Presto! You have now successfully linked your WordPress and Google Plus, giving your blog that extra personal feel. If you would like to test it out, go to http://www.google.com/webmasters/tools/richsnippets, and enter the URL of any one of your blog posts. You should see your pretty face next to it. Enjoy!

Screen Shot 2013-06-07 at 11.53.16 AM

Permanent Google Hangout Link

Permanent Google Hangout Link

So, would you like to know how to create a permanent Google Hangout Link?

Background

We are using Google Hangouts a lot in my workplace. We use it for our nerd discussions, as well as our daily standup meetings. It is a great way for us to collaborate in a meetings without actually having to be in the room together. The one thing that we were lacking was being able to create a permanent Google hangout link, shorten it, and put it in our chat subject bar for easy access. IT turns out there is a very simple trick for doing that. (more…)

Get email about new posts

Get the latest posts delivered to your mailbox: