Skip to content

Instantly share code, notes, and snippets.

View miguelarauj1o's full-sized avatar
🎯
Focusing

Miguel Araujo miguelarauj1o

🎯
Focusing
View GitHub Profile
import Cocoa
class GeneralThing<S> {
var stuff: S?
func doIt() {
if let s = stuff {
doWithStuff(s)
}
}
@miguelarauj1o
miguelarauj1o / iterm2-solarized.md
Created November 1, 2016 22:39 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font (OS X / macOS)

Solarized

import Darwin
public func arc4random <T: IntegerLiteralConvertible> (type: T.Type) -> T {
var r: T = 0
arc4random_buf(&r, UInt(sizeof(T)))
return r
}
public extension UInt {
public static func random(lower: UInt = min, upper: UInt = max) -> UInt {
@miguelarauj1o
miguelarauj1o / introrx.md
Created August 24, 2016 00:58 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

Videos

@miguelarauj1o
miguelarauj1o / .profile
Created April 21, 2016 14:01 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@miguelarauj1o
miguelarauj1o / NSString+Random.h
Created April 7, 2016 20:27 — forked from mdippery/NSString+Random.h
Generate random strings in Objective-C
/*
* Copyright (C) 2011 Michael Dippery <mdippery@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@miguelarauj1o
miguelarauj1o / podforceupdate.sh
Created April 7, 2016 19:37 — forked from mbinna/podforceupdate.sh
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@miguelarauj1o
miguelarauj1o / minReduce.swift
Created February 10, 2016 21:23 — forked from kristopherjohnson/minReduce.swift
Using Swift reduce() and min() to find minimum value in an array
struct Value {
let num: Int
init(_ n: Int) { num = n }
}
let a = [Value(3), Value(2), Value(1), Value(4), Value(5)]
let min1: Value = a.reduce(Value(Int.max)) {
($0.num < $1.num) ? $0 : $1
@miguelarauj1o
miguelarauj1o / api-json.playground
Created February 3, 2016 00:38 — forked from jeffdonthemic/api-json.playground
Swift API call & parsing JSON
import Foundation
import XCPlayground
XCPSetExecutionShouldContinueIndefinitely()
/**
* Paste all the code from the following file
- https://github.com/lingoer/SwiftyJSON/blob/master/SwiftyJSON/SwiftyJSON.swift
**/