Add Colorful Cows to Your Terminal

Have you ever wanted to see a random, funny and colorful message every time you launch your terminal? Well I did, and and here’s how you can do it too.

Continue Reading

Use React Dev Tools in Electron

I recently set up React Dev Tools inside an Electron app, so I thought I’d write a small tutorial on it. The whole process should take less than five minutes so let’s get started. Step 1 – Install React Dev Tools Chrome Extension Before we can use React Dev Tools in Electron, we need a copy of it. To do that, install it from the Chrome Web Store Step 2 – Locate the Extension Files Chrome puts all extension files under the extension’s ID.

Continue Reading

Generators in Go

While Go does not have an official construct for generators, it is possible to use channels to achieve the same effect. Below is a function called count that generates numbers from 0 to n. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~// // Generator that counts to n // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~// func count(n int) (chan int) { ch := make(chan int) go func () { for i := 0; i < n; i++ { ch <- i } close(ch) }() return ch } func main() { for i := range count(10) { fmt.Println("Counted", i) } } As you can see, our main function can now use count like a generator without needing to handle channel creation.

A Simple Web Scraper in Go

In my day job at Sendwithus, we’ve been having trouble writing performant concurrent systems in Python. We’ve come to the conclusion that Python just isn’t suitable for some of our high throughput tasks, so we’ve started playing around with Go as a potential replacement. After making it all the way through the Golang Interactive Tour, which I highly recommend doing if you haven’t yet, I wanted to build something real. The last task in the Go tour is to build a concurrent web crawler, but it faked the fun parts like making HTTP requests and parsing HTML.

Continue Reading

Build a Blog Email Subscription Service using Zapier and Sendwithus

There are many different ways to get notified of new posts for you favourite blogs. For example, you could subscribe via RSS or follow a Twitter account (if there is one). There is also the good ol’ fashioned way – email subscriptions. I wanted to add email subscription notifications to my blog (the thing you’re reading) but didn’t want it to be a manual process email every time I published something new.

Continue Reading

How to Make Android Camera Permission Optional

I have an Android app called To Read. To Read allows you to search for books and add them to a reading list. This weekend I added the ability to add a book by scanning a barcode. When I uploaded the finished app to the developer console, this is what I saw. 336 different Android devices can no longer see or install my app from the Play Store?! Since the camera is not required to use the basic functionality of the app, I wanted to make the permission optional.

Continue Reading

Swig Templating in Chrome Packaged Apps

tl;dr Check out the sample code on github I’ve been working on a Chrome Packaged App (Insomnia REST Client) for the past couple months and have leaned a lot. One of the biggest challenges about Packaged Apps is working around the Content Security Policy (CSP). The CSP makes it difficult to do common tasks such as accessing remote resources, embedding iframes, or using templating libraries. Today, I’m going to demonstrate how to use a sandboxed iframe and message passing to achieve template rendering with the Swig templating engine.

Continue Reading

Google Analytics in Chrome Packaged Apps

tl;dr use the Chrome Platform Analytics Library. Today I released my first Chrome Packaged App. When I first set out to build a packaged app I didn’t know how restrictive it would be. For security reasons, Google disallows a lot of behavior that is usually acceptable in regular web development. One of these behaviors is the execution of external scripts, such as Google Analytics. After spending a while on Google, I figured out how to properly use Google Analytics in a Chrome Packaged App.

Continue Reading

Ubuntu Update – Not Enough Free Space

Twice now this has happened to me. After clicking the button to install updates an error message appears saying “Not enough free disk space”. After some Googling, I found a solution on the Ask Ubuntu Forums. This happens because some kernel packages hang around even after updated ones replace them. The solution is simple. Delete what is no longer being used. Step 1 – Find Your Kernel Release There is a handy command you can use called uname, which can print out various system information.

Continue Reading

Domain Redirection Using Amazon S3

Setting up redirect is one of the most common tasks in web development. Whether redirecting a single page to another, or redirecting an entire domain to a new one. Knowing how to set up redirects is a basic requirement for any web developer. In this post, I’m going to show you how to set up a domain redirect with nothing more than an Amazon S3 bucket. Common Use Cases There are a lot of different use cases for redirection.

Continue Reading