Skip to content

Instantly share code, notes, and snippets.

View iSame7's full-sized avatar

Sameh Mabrouk iSame7

View GitHub Profile
@iSame7
iSame7 / AlmostEquatable.swift
Created August 15, 2017 11:16 — forked from erynofwales/AlmostEquatable.swift
An AlmostEquatable protocol for Swift floating point types
import Foundation
public protocol AlmostEquatable {
@warn_unused_result
func ==~(lhs: Self, rhs: Self) -> Bool
}
public protocol EquatableWithinEpsilon: Strideable {
static var Epsilon: Self.Stride { get }
}
@iSame7
iSame7 / 0_reuse_code.js
Created January 12, 2017 21:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@iSame7
iSame7 / DictionaryConvertable.swift
Created August 24, 2016 01:39 — forked from IanKeen/DictionaryConvertable.swift
Protocol to handle conversions between Models (class or struct based) and Dictionaries. Model to Dictionary has a default implementation provided for simple 1:1 Models
protocol DictionaryConvertable {
static func fromDictionary(dictionary: [String: AnyObject]) throws -> Self
func toDictionary() -> [String: AnyObject]
}
protocol DictionaryValueType {
func dictionaryValue() -> AnyObject?
}
extension Optional: DictionaryValueType {
func dictionaryValue() -> AnyObject? {