Goroutines, Channels and awaiting Asynchronously Operations in Go

Golang has fantastic support for actions that are supposed to happen concurrently (at the same time) without blocking the thread, they are called goroutines and are used by simply putting go in front of a function.

The functions prefixed with go will run “on their own” and the rest of your code will continue to run.

In order to gather results or returns from the functions, you commonly make use of a channel. Channels are the collecting “buckets” that will receive what your goroutines write to them.

Continue reading “Goroutines, Channels and awaiting Asynchronously Operations in Go”

WordPress Filters Example for Beginners

WordPress comes with a lot of built in amazingness, one of those are filters. You can filter a lot of different things that WordPress outputs into your theme or from your plugin that originate from another place.

That means you can add or remove something to all titles, category names or widgets. That might not seem incredibly useful at first, but if you for example want to add a text at the end of a blog post or page while using an already existing theme, it can be very nifty.

Continue reading “WordPress Filters Example for Beginners”

Parsing Your Data from the Habitica API

I’ve been using the Habitica Habit Tracker recently and it’s been a really good app to handle all sorts of history tracking. How much water do I drink? How many cigarettes do I smoke per day? Hint: recently very few.

Fortunately Habitica also has an API that lets you work with your entire history programmatically and to display it in every chart you can imagine.

The chart I wanted was to look at the history of how many cigarettes I had smoked per day. If you’re a smoker you probably know that it’s more of a day by day thing how much energy you have to fight the urge of simply going for another smoking break or lighting another cigarette.

Continue reading “Parsing Your Data from the Habitica API”

Habitica Habit Tracker Review

Habitica, formerly known as HabitRPG is a habit tracker app for Android and iOS that also comes with an accompanying website to enable you to track your habits or keep ToDo Lists.

The concept is simple, you enter your habits, daily tasks and ToDos and then you have an easy way to keep track of what you do how much. The tasks are segmented in

  • Habits (good and bad ones)
  • Daily Tasks (also weekly or monthly possible)
  • regular Todo Items

Also every task can have a difficulty. Drink Water for example I find trivial, but running 5k is medium/hard (at least in my world).

Continue reading “Habitica Habit Tracker Review”

How to Create a Custom Landing Page in WordPress

If you’re using a WordPress theme you’re actually quite happy with, but you just want to change the appearance of individual pages completely, you can make use of two great things in WordPress. The possibility to create child themes and custom page templates.

For jonathanmh.com I wanted a great first page load time that enables users to quickly see what the page is about and not just show my latest blog posts. At the time of writing I’m using the twentyfifteen WordPress theme, but I wanted the front page to be separate from that entirely.

Continue reading “How to Create a Custom Landing Page in WordPress”

How To: Detect Ad Blockers (adblock, uBlock, etc)

As a blogger or any other kind of publisher, you might be interested in if the user accessing your page right now is using an ad blocker or not. You might want to do that to display a box that encourages them to disable their ad blocker, because you’re trying to make a living off of blogging or to make more conscious decisions about how you’re going to layout your page.

If a user has an adblocker installed, you don’t have to reserve the space in your layout for the ad units, so you might as well get rid of them, so in this post we’re going to have a look at how we can determine if a user has installed an ad blocker like Adblock, Adblock Plus or uBlock.

Continue reading “How To: Detect Ad Blockers (adblock, uBlock, etc)”

YouTube disables Monetization for Low Traffic Channels

I got an email yesterday that told me that Google / YouTube decided to kick me out of the YouTube Partner program because I don’t have enough watch time.

Now, I’m not the only one who got that email and admittedly I don’t have a lot of traffic on my YouTube channel. It’s not even the channel for this blog, it’s the channel for Unganked, a video gaming channel nobody has ever heard of. It got kicked from the YouTube partner program because it had less than 4000 hours of watch time in the past 12 months and less than 1000 subscribers.

Continue reading “YouTube disables Monetization for Low Traffic Channels”

Illustrated Guide to getting started with Golang

Go is a great language by many accounts. When I first got started with Go, I didn’t have a lot of experience with programming languages that required a specific workspace or a lot of setup.

Go requires you to set 2 or 3 variables, add stuff to your $PATH (what?) and also expects you to put your files in a certain directory structure. This can be a bit offputting when you’re used to just doing whatever you want.

Full disclosure, this is a less accurate and less informative version of How to Write Go Code from the official website.

Continue reading “Illustrated Guide to getting started with Golang”

Creating a Chatbot for Slack with Node.js in 17 lines

Creating a chatbot for Slack, the easy to setup group chat for teams was surprisingly easy. In this post we’re going to go over creating a chat bot that can reply to queries and take an action on simple keywords.

We’re going to use a node module called BotKit, which will enable us to connect to Slack easily. Actually Botkit offers a GUI (paid plans) and also connects to Microsoft Teams, Spark, Twilio and even Facebook.

One of the things I like the most about it is that you can kind of build a bot once and then re-use components across different platforms, which is super cool.

This post is written with

  • node 9.3.0

but will probably be up and downwards compatible fairly far since the dependency has been around for a while.

Continue reading “Creating a Chatbot for Slack with Node.js in 17 lines”

Managing Dependencies with Govendor (Heroku, Dokku)

govendor is a dependency manager for Go. Go get gets you pretty far when it comes to installing dependencies at first, but when you want to deploy your project or when you want to pin the right version of your dependency it’s not necessarily appropriate to use.

With govendor you can, like with npm or other tools specify which version of your dependency your project uses, which is a huge benefit for systems that are required to be somewhat stable.

Continue reading “Managing Dependencies with Govendor (Heroku, Dokku)”