Skip to content

Instantly share code, notes, and snippets.

View nunogoncalves's full-sized avatar

Nuno Gonçalves nunogoncalves

View GitHub Profile
@mikaxyz
mikaxyz / AppDelegate.swift
Last active December 30, 2015 11:34
Namespaced classes in swift
//
// AppDelegate.swift
// Namespaced
//
// Created by Mika Jauhonen on 2014-09-18.
// Copyright (c) 2014 Mika Jauhonen. All rights reserved.
//
import UIKit
@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:

@jlawton
jlawton / blur-and-darken.m
Last active July 17, 2018 19:23
CIFilter Blur
// Fix for https://github.com/bryanjclark/ios-darken-image-with-cifilter
-(instancetype)darkened:(CGFloat)alpha andBlurredImage:(CGFloat)radius blendModeFilterName:(NSString *)blendModeFilterName {
CIImage *inputImage = [[CIImage alloc] initWithImage:self];
CIContext *context = [CIContext contextWithOptions:nil];
//First, create some darkness
CIFilter* blackGenerator = [CIFilter filterWithName:@"CIConstantColorGenerator"];
@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.

@kzap
kzap / gist:5819745
Last active May 27, 2020 23:09
If you want to give only Travis-CI access to a private key or secret file in your repository, you will need to encrypt it, but rather than storing the entire encrypted file in an environment variable, just store the a secret password in a secure environment variable that you will use to encrypt and decrypt your private key file. The encryption o…
# generate your private key, put the public key on the server you will be connecting to
ssh-keygen -t rsa -f ./my_key
# generate the password/secret you will store encrypted in the .travis.yml and use to encrypt your private key
cat /dev/urandom | head -c 10000 | openssl sha1 > ./secret
# encrypt your private key using your secret password
openssl aes-256-cbc -pass "file:./secret" -in ./my_key -out ./my_key.enc -a
# download your Travis-CI public key via the API. eg: https://api.travis-ci.org/repos/travis-ci/travis-ci/key
@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:

@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 / 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.


@Star-Lord-XIII
Star-Lord-XIII / SwiftInST3.md
Last active June 21, 2021 01:52
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",
@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]