Jan 25, 2016

Complex number

Since a complex number is comprised of a real and imaginary component, two complex numbers are equal if and only if their respective real and imaginary components are equal.

Read on  

  Jan 24, 2016

TLDR iOS App

build-status Twitter appStore

TL;DR (iOS Version)

TL;DR is a open source project which maintains a list of man pages. This project is the iOS Client of that.

Read on  

  Jan 24, 2016

Strange Swift Protocol

Swift protocol is very interesting yet very weird. Sometimes it behaves very strangely.

import Foundation

protocol Command {}

struct TLDRCommand: Command {}

// Works
func getOk() -> [Command] {
    return [TLDRCommand(), TLDRCommand(), TLDRCommand()]
}

// Does not work
func getFail() -> [Command] {
    let myArray = [TLDRCommand(), TLDRCommand(), TLDRCommand()]
    return myArray
}

// Casting also does not work
func getFail2() -> [Command] {
    let myArray = [TLDRCommand(), TLDRCommand(), TLDRCommand()]
    return myArray as [Command]
}

// This works, no complain about RHS not being the type of LHS
func getOk2() -> [Command] {
    let myArray: [Command] = [TLDRCommand(), TLDRCommand(), TLDRCommand()]
    return myArray
}

// And this also this works
func getOk3() -> [Command] {
    var myArray: [Command] = []
    myArray.append(TLDRCommand())
    myArray.append(TLDRCommand())

    return myArray
}
Read on  

  Jan 24, 2016

A command line tool to create swift playground

playground

A command line application to quickly create and launch a Xcode playground.

NPM version build-status License Dependency Status devDependency Status download  numbers Twitter

Read on  

  Jan 01, 2015

Greetings and Goodbye 2014 !

Hello and a happy new year to everybody. 2014 was a year of trial and errors for myself. We were finally able to incorporate LaoHan Pte Ltd officially in Singapore. we have been thinking about doing a lot of stuffs and now it’s time we actually start putting words into work. ….

Read on