Skip to content

Instantly share code, notes, and snippets.

View shial4's full-sized avatar
⌨️

Szymon shial4

⌨️
View GitHub Profile
@T1T4N
T1T4N / URLSession+DataTaskProgressPublisher.swift
Last active May 2, 2023 07:39
Emulating a DataTaskPublisher with Progress
#if canImport(Combine)
import Foundation
import Combine
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension URLSession {
public typealias DataTaskProgressPublisher =
(progress: Progress, publisher: AnyPublisher<DataTaskPublisher.Output, Error>)
@shial4
shial4 / Log.swift
Last active August 27, 2018 02:38
Swift Logger
import Foundation
public class Log {
private enum LogType: Int, CustomStringConvertible {
public var description: String {
switch self {
case .verbose:
return "[VERBOSE]"
case .info:
return "[INFO]"
@hollance
hollance / XOR.swift
Created January 11, 2017 18:05
Playing with BNNS (Swift version). The "hello world" of neural networks.
/*
The "hello world" of neural networks: a simple 3-layer feed-forward
network that implements an XOR logic gate.
The first layer is the input layer. It has two neurons a and b, which
are the two inputs to the XOR gate.
The middle layer is the hidden layer. This has two neurons h1, h2 that
will learn what it means to be an XOR gate.