Skip to content

Instantly share code, notes, and snippets.

View nunogoncalves's full-sized avatar

Nuno Gonçalves nunogoncalves

View GitHub Profile
/// |                    World                 |
/// |------------------------------------------|
/// | Module A | Module B | Module C | Module D|
  1. World is a module
  2. World is aware of all modules.
  3. Modules aren't aware of World.
@AliSoftware
AliSoftware / Demo.swift
Last active October 31, 2023 12:25
NestableCodingKey: Nice way to define nested coding keys for properties
struct Contact: Decodable, CustomStringConvertible {
var id: String
@NestedKey
var firstname: String
@NestedKey
var lastname: String
@NestedKey
var address: String
enum CodingKeys: String, NestableCodingKey {
@mnem
mnem / man xccov
Last active October 4, 2021 12:10
xccov(1) xccov(1)
NAME
xccov - view Xcode coverage data in human-readable or machine-parseable format.
SYNOPSIS
xccov view [--only-targets | --files-for-target target_name | --functions-for-file name_or_path]
// 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
cojoj / list.md
Last active November 19, 2020 08:04
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
vetras / WallOfShame.md
Last active February 4, 2019 12:42
Programming perls I encountered myself over the years. Epic mistakes to remember. Things I've seen that cannot be unseen.

Wall of shame

Introduction

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
vetras / git_commands.md
Last active May 27, 2021 13:24
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
vetras / keybase.md
Created February 9, 2016 14:34
verifying keybase identity

Keybase proof

I hereby claim:

  • I am vetras on github.
  • I am vetras (https://keybase.io/vetras) on keybase.
  • I have a public key ASCjwL9xKpMa0_hVF72KyxyLGDHl_dKoOVzpb1BQr3dwLgo

To claim this, I am signing this object:

@Star-Lord-XIII
Star-Lord-XIII / SwiftInST3.md
Last active November 11, 2024 14:05
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
nicklockwood / gist:21495c2015fd2dda56cf
Last active August 13, 2020 13:57
Thoughts on Swift 2 Errors

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: