I hereby claim:
- I am superlopuh on github.
- I am superlopuh (https://keybase.io/superlopuh) on keybase.
- I have a public key ASDG9sV7x-2PNGdsF17xpvgC82Y6bwruku27vlEgnJEG8go
To claim this, I am signing this object:
#!/usr/bin/env xcrun swift | |
import Cocoa | |
func smallestPrimeFactorOf(integer: Int) -> Int? { | |
let upperBound = Int(sqrt(Double(integer))) | |
var attempt = 2 | |
while attempt <= upperBound { | |
if integer % attempt == 0 { |
#!/usr/bin/env xcrun swift | |
import Cocoa | |
func smallestPrimeFactorOf(integer: Int, andMinGuess minGuess: Int = 2) -> Int? { | |
let upperBound = Int(sqrt(Double(integer))) | |
var attempt = minGuess | |
while attempt <= upperBound { | |
if integer % attempt == 0 { |
import Cocoa | |
func smallestPrimeFactorOf(integer: Int, var withMinGuess minGuess: Int = 2) -> Int? { | |
let upperBound = Int(sqrt(Double(integer))) | |
while minGuess <= upperBound { | |
if integer % minGuess == 0 { | |
return minGuess | |
} | |
minGuess++ |
// Written by Alexandre Lopoukhine | |
protocol Value: Equatable {} | |
protocol Smashable { | |
typealias SmashValue | |
func valueBySmashingOtherValue<T: Value>(value: T) -> SmashValue | |
} | |
struct Bar: Value { |
let myString: String? = nil | |
func ~=<T: Equatable>(values: [T?], value: T?) -> Bool { | |
return values.contains({$0 == value}) | |
} | |
if [nil, ""] ~= myString { | |
... | |
} |
# MIT License | |
# | |
# Copyright (c) 2017 Snips | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
import Darwin | |
// MARK: Integers | |
extension UInt32 { | |
/// Returns a random number in `0...UInt32.max` | |
static func random() -> UInt32 { | |
return arc4random() | |
} |
extension BidirectionalCollection { | |
public func last(where predicate: (Element) throws -> Bool) rethrows -> Element? { | |
for element in self.reversed() where try predicate(element) { | |
return element | |
} | |
return nil | |
} | |
} |
I hereby claim:
To claim this, I am signing this object:
extension CAShapeLayer { | |
struct Model { | |
let path: UIBezierPath | |
let strokeColor: UIColor? | |
let fillColor: UIColor | |
let lineWidth: CGFloat | |