Lately I decided to experiment with Web Assembly just to get the feel of the concept, on my first impression it’s was very nice. What I did is written a wasm app to interface with jQuery and use go html/template system, it worked, it fetches data from html using jQuery, fed it to the template than return rendered html back to jQuery and place in the #box.

package main

import (

func JQuery(args ...interface{}) js.Value {
	return js.Global().Call("jQuery", args...)

const htmlTemplate = `
<h2>{{ .Forename }} {{ .Surname }}</h2>

func checkAndUpdate(event js.Value, tpl *template.Template) {
	type context struct {
		Forename string
		Surname  string
	buf := &bytes.Buffer{}
	tpl.Execute(buf, context{
		Forename: JQuery("#forename").Call("val").String(),
		Surname:  JQuery("#surname").Call("val").String(),

	JQuery("#box").Call("html", buf.String())

func ipAddress() {
	res, _ := http.Get("")
	b, _ := ioutil.ReadAll(res.Body)

	JQuery("#ipAddress").Call("text", strings.TrimSpace(string(b)))

func main() {
	tpl := template.Must(template.New("template").Parse(htmlTemplate))

	JQuery("#forename, #surname").
		Call("on", "keyup", js.NewEventCallback(js.PreventDefault, func(event js.Value) {
			checkAndUpdate(event, tpl)


	select {}

As awesome, as it is, I wouldn’t get too excited yet, the only issue I have at the moment is the file size, it’s 9 megabyte or 1.5 megabyte compressed, but I’m confident that the gophers will get this issue fixed in future release of go.

Web Assembly IMHO, has got serious potentials for the future.

Source Code Web Assembly

It’s was fun experimenting with WASM. The idea of using binary inside a web browser is great.

10/07/2018 22:34 BST

While I was in progress of creating the admin panel for this site, I needed something I can rely on for form validation, I did try to have a look at other solutions online, I honestly did not find them suitable for my needs. So I decided to write my own solution.

All it’s is really is just a raw value validator, I find that it’s works quite well even for the most quirkiest of form or even an array of multiple form. On this site each blog post has multiple component, each of them have their own validation rules and each component has a hash and it’s suffix to the form field, so it’s does not conflict with the other component.

10/06/2018 13:14 BST

I have been very busy with refactoring my site, hench the lack of update, I have made heavy use of functional programming and I got rid of most of the side effect; it had a more pleasant impact on code maintenance and writing test, I don’t have to worry about a database connection initialising while running the test, previously to stop the database from initialising I made use of build tags, I added a comment // +build !debug on top of the file where the database connection get initialised it was inelegant, with FP I don’t have to do that anymore, but I still use // +build debug for the mocks. I’m not going to go into too much about the problem of impure function, but I will leave a video, cheers.

He has inspired me to refactor my site, believe it or not.

03/04/2018 13:05 BST

Ever since my childhood, although I did pray at school (they kind of force me to, I never like my school) I have never been much of religious person, nowadays I just see myself as an agnostic-atheist, I have never seen any good scientific evidence of the existence of at least one god; however I do believe there is a possibility of life in space but in a form of aliens on another planet, it’s obviously going to be a planet that is over 100 light-years away, might be in a same galaxy as us (the Milky Way) or a different galaxy, who knows? of course we got photographics evidence of other galaxy existing on google, they all came from the hubble telescope built by NASA take you pick.

| |