Skip to content

Instantly share code, notes, and snippets.

View jayrhynas's full-sized avatar

Jayson Rhynas jayrhynas

View GitHub Profile
@interface NSDictionary (Unicode)
- (NSString *)unicodeDescription;
- (NSString *)unicodeDescription:(int)level;
@end
@interface NSArray (Unicode)
- (NSString *)unicodeDescription;
- (NSString *)unicodeDescription:(int)level;
@end
extension NSThread {
class func logCallStack(showRedacted showRedacted: Bool = false) {
#if DEBUG
let removeRedacted: String -> Bool = { symbol in
return showRedacted ? true : symbol.rangeOfString("<redacted>", options: []) == nil
}
let swiftSymbolRegex = try! NSRegularExpression(pattern: " (_T\\S+) \\+", options: [])

Keybase proof

I hereby claim:

  • I am jayrhynas on github.
  • I am jayrhynas (https://keybase.io/jayrhynas) on keybase.
  • I have a public key ASAan9xR_hUNXRr1Gw_R_joUKVyBBsGTTnH9EL8IHh1gYwo

To claim this, I am signing this object:

func checkAll<T1, T2, T3>(clauses: (T1?, T2?, T3?)) -> (T1, T2, T3)? {
guard let one = clauses.0 else {
print("1st clause is nil")
return nil
}
guard let two = clauses.1 else {
print("2nd clause is nil")
return nil
}
import Foundation
func asyncFor<T>(_ initial: T, _ condition: @escaping (T) -> Bool, _ update: @escaping (T) -> T, _ body: @escaping (T, @escaping () -> Void) -> Void, _ done: @escaping () -> Void) {
var state = initial
var next: (() -> Void)!
next = {
body(state, {
state = update(state)
if condition(state) { next() }
//
// LocalizedString.swift
// Medly
//
// Created by Jayson Rhynas on 2016-03-29.
// Copyright © 2016 Medly Labs Inc. All rights reserved.
//
import Foundation
import Foundation
extension String {
func quotedSplit(separator: String = " ", quote: String = "\"") -> [String] {
let escapedQuote = "\\\(quote)"
var parts: [String] = []
var quotedPart: String? = nil
@jayrhynas
jayrhynas / zip.swift.gyb
Last active March 14, 2017 18:13
zip gyb + example
%{
arities = range(3, int(maxArity) + 1)
def iterateWith(str, sep):
return sep.join([str.format(i) for i in indexes])
}%
%for arity in arities:
%indexes = range(1, arity + 1)
// MARK: - zip${arity} implemenetation
public struct Zip${arity}Iterator<${iterateWith("Iterator{0}: IteratorProtocol", ", ")}> : IteratorProtocol {
//
// main.m
// MethodSignatureTest
//
// Created by Jayson Rhynas on 2017-04-03.
// Copyright © 2017 Jayson Rhynas. All rights reserved.
//
#import <Foundation/Foundation.h>
git config --global alias.standup "log --pretty='format:%Cgreen%>(8)%ad%Creset %s' --date='format:%l:%M %p' --since=yesterday --before=6am --reverse --author=Jayson"