(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
//: Explore an alternative approach to building the networking layer of an app from [Swift Talk #1 episode](https://talk.objc.io/episodes/S01E01-networking). | |
//: They make use of Swift's generics and structs to end up with simple, testable code. | |
//: | |
//: In this playground we are searching for photos by a specific tags with [Flickr API](https://www.flickr.com/services/api/flickr.photos.search.html). | |
import UIKit | |
import XCPlayground | |
//: `Resource` struct, which is generic over the result type. This struct has two properties: the URL of the endpoint, and a parse function. The parse function tries to convert some data into the result: |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
{ | |
"AF":"Afghanistan", | |
"AL":"Albania", | |
"DZ":"Algeria", | |
"AS":"American Samoa", | |
"AD":"Andorra", | |
"AO":"Angola", | |
"AI":"Anguilla", | |
"AQ":"Antarctica", | |
"AG":"Antigua and Barbuda", |
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |
import Foundation | |
import CoreData | |
public class CoreDataContextObserver { | |
public typealias ActionCompletionBlock = (NSManagedObject, State) -> Void | |
public typealias ContextChangeBlock = (Foundation.Notification, [ObjectChange]) -> Void | |
public struct State: OptionSet { | |
public let rawValue: Int |
import Foundation | |
private final class WeakBox<T: AnyObject> { | |
weak var value: T? | |
init(_ value: T) { | |
self.value = value | |
} | |
} |
// | |
// Created by Ivan Magda on 25/10/2018. | |
// Copyright © 2018 Ivan Magda. All rights reserved. | |
// | |
import Foundation | |
final class ReadWriteLock { | |
private var rwlock: pthread_rwlock_t = { | |
var rwlock = pthread_rwlock_t() |
[ | |
{ | |
"id":1, | |
"type": "score", | |
"time": 0, | |
"episode": 1, | |
"episode_time": 0, | |
"score" : [0,0] | |
}, | |
{ |
[ | |
{ | |
"id":2, | |
"poll_id":2, | |
"type": "poll_started", | |
"time": 1, | |
"episode": 1, | |
"episode_time": 0, | |
"subject" : { | |
"title": "Sportscaster", |