Skip to content

Instantly share code, notes, and snippets.

Avatar
Coffee(ing)

Abdullah Pre1

Coffee(ing)
View GitHub Profile
View rangePattern.swift
precedencegroup RangePattern {
associativity: left
lowerThan: RangeFormationPrecedence
}
infix operator .. : RangePattern
extension Float {
var samePrecision: Float {
return Float(description) ?? 0.0
}
}
@Pre1
Pre1 / Networking.swift
Created Jun 18, 2016
from Swift Talk 1st episode
View Networking.swift
// Check out the talk: https://talk.objc.io/episodes/S01E01-networking (Part 1)
// the talk uses swift 2 and I follow along by writing it in swift 3.
import Foundation
import PlaygroundSupport
//extension Sequence {
// public func failingFlatMap<T>(_ transform: @noescape(Self.Iterator.Element) throws -> T?) rethrows -> [T]? {
// var result: [T] = []
// for element in self {
@Pre1
Pre1 / 99bottles.swift
Last active Apr 14, 2016
99 bottles of beer in swift 2.2...3.0
View 99bottles.swift
/*
99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 98 bottles of beer on the wall.
.
.
.
1 bottle of beer on the wall, 1 bottle of beer.
Take one down and pass it around, no more bottles of beer on the wall.
No more bottles of beer on the wall, no more bottles of beer.