Skip to content

Instantly share code, notes, and snippets.

💭
🏔🏃‍♂

Rui Peres RuiAAPeres

💭
🏔🏃‍♂
Block or report user

Report or block RuiAAPeres

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:07a8f3459532bbb952b1dd480ec0913c
Process: Xcode [3786]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 8.3 (12169)
Build Info: IDEFrameworks-12169000000000000~2
App Item ID: 497799835
App External ID: 821487965
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [3786]
View gist:35226980b977a8f93fea42519049303a
Process: Xcode [2788]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 8.3 (12169)
Build Info: IDEFrameworks-12169000000000000~2
App Item ID: 497799835
App External ID: 821487965
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [2788]
View gist:55f176c1a695e929db92e179e9946281
Process: Xcode [91355]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 8.3 (12169)
Build Info: IDEFrameworks-12169000000000000~2
App Item ID: 497799835
App External ID: 821487965
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [91355]
View gist:a6b4ee7c4b2f370359b34c0de25d36c2
Process: Xcode [50680]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 8.3 (12169)
Build Info: IDEFrameworks-12169000000000000~2
App Item ID: 497799835
App External ID: 821487965
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [50680]
View gist:a89e3582a95005b42fec121c03d6e19e
Process: Xcode [50464]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 8.3 (12169)
Build Info: IDEFrameworks-12169000000000000~2
App Item ID: 497799835
App External ID: 821487965
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [50464]
View shunting.swift
//: Playground - noun: a place where people can play
import Cocoa
enum Symbol {
case MathOperator(Operator)
case MathParenthesis(Parenthesis)
init?(symbol: Character) {
@RuiAAPeres
RuiAAPeres / converter.swift
Created May 9, 2016
Quick & Dirty txt2JSON converter
View converter.swift
#!/usr/bin/env xcrun swift
import Foundation
func buildFullPath(fileName: String) -> String {
let cwd = NSFileManager.defaultManager().currentDirectoryPath
let urlCwd = NSURL(fileURLWithPath: cwd)
if let urlPath = NSURL(string: fileName, relativeToURL: urlCwd) {
View explanation.md

There is retain cycle between the Signal (a Signal is created when you start the producer, hence the name: SignalProducer) and the observer, when you use methods of the family start....

You have three ways to break this cycle:

  • You dispose of the SignalProducer (if you notice, you get a Disposable, when you use a start...). You should avoid doing this, as it goes against RAC best practises
  • You have a way to manipulate the SignalProducer. In your case you do have, by sending complete to the Observer.
  • You use methods like take, takeWhile, until, which will terminate the SignalProducer. This is the prefered way.

Regarding the dispatch. Try this in your viewDidLoad:

View gist:75e7981bb9a88ca4c280aa47768bbe78
networkResult.map { $0.count }.map(String.init).startWithNext {[weak self] numberOfResults in
self?.myLabel = numberOfResults
}
View bind.swift
myLabel.rac_text <~ networkResult.map { $0.count }.map(String.init)
You can’t perform that action at this time.