👋 Hi, I'm Yos.

Navigating the idea maze and building for web3 ☀️

Here are my recent thoughts...

Building RESTful APIs with Rails

Building RESTful APIs with Rails

I seem to be building APIs left and right, so in this post, we’ll build a RESTful API with Ruby.

There are many approaches you can take when it comes to building an API with Ruby, such as the choice of using the grape DSL, Sinatra, or Rails. There's also design considerations to be made with regards to the language you write in. Node.js and Go is preferable when performance is a core requirement. As always, consider your requirements carefully when deciding on what to use to build your API.

Let’s start with some theory on REST and RESTful APIs. Then, we’ll work through building an API which supports the following:

  • API Namespacing
  • API Versioning
  • API Request Authentication and API Keys
  • Object serialization + caching
  • HATEOAS

In Part 2, we will go into more detail on documentation, security, optimization, and testing.

Continue reading →

Refactoring Fat Rails models with Concerns

Refactoring Fat Rails models with Concerns

In this post, we’ll be taking a close look on how to avoid the proverbial ‘Ball of Mud’ in object-oriented design. Specifically, we’ll be refactoring fat Rails models using ActiveSupport::Concerns.

I highly recommend reading POODR for more in-depth refactoring techniques and proper OO design. It's helped me tremendously while working on SheetHub.
Continue reading →

Rails Vulnerability Scanning and Static Analysis

Static program analysis is the analysis of computer software that is performed without actually executing programs (analysis performed on executing programs is known as dynamic analysis). The term is usually applied to the analysis performed by an automated tool, with human analysis being called program understanding, program comprehension, or code review. – More on Static Analysis

Have you ever wondered how QA services such as Codeclimate and New Relic measures your code quality? They use the Brakeman static analyser.

Continue reading →

Red Dot Ruby Conference 2014

Missed RDRC? You can view the presentation materials here: Red Dot Ruby Conference 2014

I had the pleasure of attending this year’s Red Dot Ruby Conference, a locally organized tech conference for Ruby developers.

RedDotRubyConf is the largest Ruby conference in South East Asia - a two day single-track event that brings together renowned international and local speakers.

I’ve learned tremendously from the speakers, most of which were prominent OSS (open source software) and core Ruby contributors such as Koichi Sasada (Ruby core team) and Aaron Patterson (Top Rails contributor.) Here, I will outline three of the lessons I’ve learned from the conference.

Continue reading →

Startup Lessons Learned - Airtime

This week, each of the CS3216 Facebook seminar teams presented an application of their choice to the rest of classroom. In this post, I’d like to highlight the Airtime team’s most significant points together with my own original thoughts as three lessons I learned from Airtime - the dream team startup that ultimately flopped.

Airtime is a video chat app that connects to your Facebook account and then connects you to other Airtime users who have similar interests, or are located geographically close to you.

Continue reading →

Grow Beyond with Google

I spent two days in Google’s Singapore office for a series of workshops, and in this post, I’d like to write (in freeform) about the things I’ve learned from the program.

Continue reading →

PyCon SG 2013

I was at this year’s Python Conference. This post summarizes what I learned.

Continue reading →

Python dependency management with virtualenv

In this post, I’d like to outline how to create and manage virtual environments each with its own, independent set of dependencies with the following packages:

  • pip, A tool for installing and managing Python packages in the Python Package Index
  • virtualenv, A tool for creating isolated Python environments containing their own copy of python, pip, and other packages
  • virtualenvwrapper, A set of convenient enhancements to virtualenv

virtualenvwrapper is a set of extensions to Ian Bicking’s virtualenv tool. The extensions include wrappers for creating and deleting virtual environments and otherwise managing your development workflow, making it easier to work on more than one project at a time without introducing conflicts in their dependencies.

The rationale behind virtual environments is to make available reproducible, isolated sets of dependencies/python packages without much configuration and without having to watch and manage the packages’ different versions.

Continue reading →

Learn Vim in 5 minutes

Quick! Let’s learn some minimal vi commands!

In a Vim editor:

  • press i to go into insert mode, start typing your text
  • press Esc to go back to normal mode
  • then write the file and quit with :wq + <Enter>

Congratulations. You have joined the great fraternity of people who know this ancient, revered text editor.


These are the essential commands you will need to get started with git commit messages.

Additional reading:

The Decorator pattern in Python

In object-oriented programming, the decorator pattern (also known as Wrapper, an alternative naming shared with the Adapter pattern) is a design pattern that allows behavior to be added to an individual object, either statically or dynamically, without affecting the behavior of other objects from the same class.

In functional languages such as Scheme and Haskell, functions are first-class. This means that we can pass functions as arguments to other functions, assign functions to variables, and have them as return values just like any other primitive data types such as integers and strings.

In Python, functions are likewise treated as first-class citizens. In fact, the language provides syntactic sugar known as decorators which makes wrapping functions and function transformations even easier.

Continue reading →