Skip to content

Instantly share code, notes, and snippets.

Working from home

Piotr Godek iampeter

Working from home
  • Morialta Software
  • Adelaide, Australia
View GitHub Profile
View robot.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
iampeter /
Last active Dec 13, 2019
Implementing tagging in Golang with Postgres JSONB type and SQLX

When you need to handle text tags in Golang, eg. a Document can be tagged with software engineering, important and golang, you could do it with the Postgres text[] array type.

But with the jsonb type, you have all the marshalling and unmarshalling already there, so all you need to do is have a []string type, like below:

type JSONTags []string

func (tags *JSONTags) Scan(src interface{}) error {
iampeter /
Last active Aug 29, 2015 — forked from JamesDullaghan/
Deploy rails app to digitalocean with nginx, unicorn, capistrano & postgres

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@

Add ssh fingerprint and enter password provided in email

iampeter / gist:30957587b414403de27f
Created Mar 29, 2015
Sending SMS from Cordova without any plugin on Android using Crosswalk
View gist:30957587b414403de27f

Did you know that using Crosswalk you can send an SMS without any plugin in Cordova for Android?

xwalk.experimental.messaging.sms.send(number, text).then(function (message) {
  console.log("Message sent");

}), function (error) {
  console.log("Error!, Error!");
iampeter / gist:5af9c9e113e41c954364
Last active Apr 14, 2020
Simple proxy with hapi.js to fix your CORS problems
View gist:5af9c9e113e41c954364


While building a JavaScript single page app that acts as a front-end to multiple backend servers, even if they are on the same host as the web app - but on different ports, you come across CORS issues.


Use a simple node.js + hapi.js server to:

  1. Serve your static single page app
  2. Act as proxy to the backend servers
iampeter /
Last active Aug 29, 2015
Backbone Marionette - route handling inside modules
TodoModule = require './modules/todo/TodoModule'
class App extends Backbone.Marionette.Application
initialize: =>
@router = new Backbone.Marionette.AppRouter
@module('Todo', TodoModule)
@addInitializer( (options) =>