Skip to content

Instantly share code, notes, and snippets.

View nunogoncalves's full-sized avatar

Nuno Gonçalves nunogoncalves

View GitHub Profile
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]
@nunogoncalves
nunogoncalves / env-vars.sh
Last active April 10, 2018 22:30
Local environment variables
export GITHUB_CLIENT_ID=<valid_id>
export GITHUB_CLIENT_SECRET=<valid_secret>
struct GithubCreds {
static let clientId = "CLIENT ID"
static let clientSecret = "CLIENT SECRET"
}
@nunogoncalves
nunogoncalves / create_credentials_swift_struct.rb
Last active April 10, 2018 22:22
Ruby script that generates a swift file with credentials
#!/usr/bin/ruby
file_content = <<-CREDS_FILE_STRING
struct GithubCreds {
static let clientId = "#{ENV['GITHUB_CLIENT_ID']}"
static let clientSecret = "#{ENV['GITHUB_CLIENT_SECRET']}"
}
CREDS_FILE_STRING
@nunogoncalves
nunogoncalves / gist:f1616daaa05a1f5e03c246606fbe8c63
Created April 1, 2018 20:31 — forked from kzap/gist:5819745
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
@nunogoncalves
nunogoncalves / Theming.swift
Created June 3, 2017 10:09
Easily apply theme styles to any UIView!
Make the following possible!
MarvelTheme.TextStyle.CommicSans.apply(to: label)
MarvelTheme.ColorStyle.dangerColor.apply(to: label)
// ============================== StylableView protocol ==============================
// Adds a consistent styling API to any UIView.
// The example here allows for any UIView subclass to have a way of setting its font type.
protocol StylableView {

Videos

extension Users {
class Getter : Requestable, WebGetter, Authenticable, EmptyBody, UrlEncodable, Deserializable {
var deserializer = Deserialize.UserDeserializer()
var url = "https://..."
func getUserDetails(success success: User -> (), failure: ApiResponse -> ()) {
call(success: success, failure: failure)
}
}
extension Users {
class Getter : Requestable {
var httpMethod = HTTPMethod.GET
var headers: HeadParams? = ["Authorization" : "Bearer \(CurrentUser.accessToken ?? "")"]
func fillHeaders() {}
var bodyParams: BodyParams? = [:]
func fillBodyParams() {}
protocol Deserializable {
associatedtype T: Deserializer
var deserializer: T { get }
func getDataFrom(dictionary: NSDictionary) -> T.MappedObject
}
extension Deserializable {
func getDataFrom(dictionary: NSDictionary) -> T.MappedObject {
return deserializer.buildFrom(dictionary)