Skip to content

Instantly share code, notes, and snippets.


Nuno Gonçalves nunogoncalves

View GitHub Profile
AliSoftware / Demo.swift
Last active Sep 7, 2020
NestableCodingKey: Nice way to define nested coding keys for properties
View Demo.swift
struct Contact: Decodable, CustomStringConvertible {
var id: String
var firstname: String
var lastname: String
var address: String
enum CodingKeys: String, NestableCodingKey {
View man xccov
xccov(1) xccov(1)
xccov - view Xcode coverage data in human-readable or machine-parseable format.
xccov view [--only-targets | --files-for-target target_name | --functions-for-file name_or_path]
View Pattern for Swift Errors.swift
// Swift's untyped errors are a goddam PiTA. Here's the pattern I use to try to work around this.
// The goal is basically to try to guarantee that every throwing function in the app throws an
// ApplicationError instead of some unknown error type. We can't actually enforce this statically
// But by following this convention we can simplify error handling
enum ApplicationError: Error, CustomStringConvertible {
// These are application-specific errors that may need special treatment
case specificError1
case specificError2(SomeType)
cojoj /
Last active Oct 13, 2019
Number of people working on iOS apps

Purpose of this list is to gather a source of information on how many people are working on iOS application.
I often wonder how many people are behind Facebook's app or Twitter's. If you're as curious as me, please share and please add apps 😉.

* - it's a rumoured value only. Needs confirmation from someone inside the company.

  1. Fishbrain - 3
  2. Artsy - 5
  3. Truecaller - 5
  4. Lifesum - 4 or 5
  5. Spotify - 50*
vetras /
Last active Feb 4, 2019
Programming perls I encountered myself over the years. Epic mistakes to remember. Things I've seen that cannot be unseen.

Wall of shame


Throughout life as a software developer you see a lot of gems. Code gems.

Things that are well done, things that are not well done and things that are just plain wrong.

Programming perls I encountered myself over the years. Mainly the bad ones.

vetras /
Last active Jan 21, 2020
List of Usefull Git commands

Git Commands

This document serves the purpose of listing some GIT commands that I find hard to remember, hard to find information about, hard to use or any combination thereof.

How to use this document

The best way to use this is to CTR+F you way through it.

vetras /
Created Feb 9, 2016
verifying keybase identity

Keybase proof

I hereby claim:

  • I am vetras on github.
  • I am vetras ( on keybase.
  • I have a public key ASCjwL9xKpMa0_hVF72KyxyLGDHl_dKoOVzpb1BQr3dwLgo

To claim this, I am signing this object:

Star-Lord-XIII /
Last active Jul 30, 2019
Running Swift scripts from Sublime Text 3 in MacOSX10.11

##Adding Swift Build System

  • Open Sublime Text 3
  • Go To Preferences > Browse Packages...
  • Add a file named Swift.sublime-build inside Packages directory.
  • Copy the following script in Swift.sublime-build file.
 	"shell_cmd": "xcrun swift $file",
nicklockwood / gist:21495c2015fd2dda56cf
Last active Aug 13, 2020
Thoughts on Swift 2 Errors
View gist:21495c2015fd2dda56cf

Thoughts on Swift 2 Errors

When Swift was first announced, I was gratified to see that one of the (few) philosophies that it shared with Objective-C was that exceptions should not be used for control flow, only for highlighting fatal programming errors at development time.

So it came as a surprise to me when Swift 2 brought (What appeared to be) traditional exception handling to the language.

Similarly surprised were the functional Swift programmers, who had put their faith in the Haskell-style approach to error handling, where every function returns an enum (or monad, if you like) containing either a valid result or an error. This seemed like a natural fit for Swift, so why did Apple instead opt for a solution originally designed for clumsy imperative languages?

I'm going to cover three things in this post:

raphaelhanneken / NSImageExtensions.swift
Last active Feb 23, 2020
NSImage extensions for easy resizing, cropping and saving png images.
View NSImageExtensions.swift
// NSImageExtensions.swift
import Cocoa
extension NSImage {
/// The height of the image.
var height: CGFloat {
You can’t perform that action at this time.