Skip to content

Instantly share code, notes, and snippets.


Michael Sealand msealand

  • Boulder Creek, CA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am msealand on github.
  • I am msealand ( on keybase.
  • I have a public key whose fingerprint is CC24 794B 721F 482D D29A 4D94 4D1D D4A1 DED6 09FD

To claim this, I am signing this object:

msealand / AsyncBlockOperation.h
Last active Mar 6, 2017
Asynchronous version of NSBlockOperation
View AsyncBlockOperation.h
#import <Foundation/Foundation.h>
typedef void(^AsyncBlock)(dispatch_block_t completionHandler);
@interface AsyncBlockOperation : NSOperation
@property (nonatomic, readonly, copy) AsyncBlock block;
+ (instancetype)asyncBlockOperationWithBlock:(AsyncBlock)block;
msealand / CGVectorUtilities.swift
Last active Sep 4, 2019
Operator overloads to do scalar vector math on CGPoint, CGSize, CGVector.
View CGVectorUtilities.swift
import CoreGraphics
protocol VectorType {
typealias Element
var xElement: Element { get }
var yElement: Element { get }
class func buildFrom(#x: Element, y: Element) -> Self
msealand / RandomCharacter.swift
Created Oct 28, 2014
Generate a random character from a range of characters (Unicode safe)
View RandomCharacter.swift
func randomCharacter<T: IntervalType where T.Bound == Character>(inRange range: T) -> Character {
let startScalars = String(range.start).unicodeScalars
let startCode = startScalars[startScalars.startIndex].value
let endScalars = String(range.end).unicodeScalars
let endCode = endScalars[endScalars.startIndex].value
let characterCount = distance(startCode, endCode) + 1
let rndOffset = Int(arc4random_uniform(UInt32(characterCount)))
You can’t perform that action at this time.