Skip to content

Instantly share code, notes, and snippets.

Zev Eisenberg ZevEisenberg

Block or report user

Report or block ZevEisenberg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ZevEisenberg
ZevEisenberg / XCTestCase+Extensions.swift
Last active Oct 4, 2019
Useful additions for common problems with XCTest
View XCTestCase+Extensions.swift
//
// XCTestCase+Unwrapping.swift
// Created by Zev Eisenberg on 6/2/19.
// Feel free to use, share, etc. No need to credit, but a link back to this page would be nice.
//
import XCTest
extension XCTestCase {
@ZevEisenberg
ZevEisenberg / File_1.json
Created Sep 5, 2019
JSON hosting example
View File_1.json
{
"some key": "some value"
}
@ZevEisenberg
ZevEisenberg / RxSignpost.swift
Last active Sep 13, 2019
Use os_signpost for performance logging of transformations in RxSwift
View RxSignpost.swift
// RxSwift signposts
import os.signpost
import RxSwift
func signpost<T>(log: OSLog, name: StaticString, value: String, _ thing: () throws -> T) rethrows -> T {
let signpostID = OSSignpostID(log: log)
os_signpost(
.begin,
@ZevEisenberg
ZevEisenberg / License
Last active Mar 2, 2019
Test lots of values without lots of boilerplate
View License
Copyright 2019 Zev Eisenberg
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:
The above copyright notice and this permission notice shall be included in all
@ZevEisenberg
ZevEisenberg / .lldbinit
Created Sep 12, 2018 — forked from woolsweater/.lldbinit
Break on unsatisfiable constraints and send to wtfautolayout
View .lldbinit
command script import ~/.lldbscripts/break_unsatisfiable.py
@ZevEisenberg
ZevEisenberg / guard.swift
Created Jul 31, 2018
Example Guard indentation
View guard.swift
let foo: Int? = nil
let bar: Int? = nil
let baz: Int? = nil
func x() {
guard
let foo = foo,
let bar = bar,
let baz = baz
else { return }
View SectionedArray.swift
struct SectionedArray<GroupKey, Item> where GroupKey: Comparable & Hashable {
struct Section {
let key: GroupKey
var items: [Item]
}
var sections: [Section]
var count: Int {
@ZevEisenberg
ZevEisenberg / Find Siteswap Loops.swift
Created Dec 4, 2017
Find how long it takes for an async siteswap to loop
View Find Siteswap Loops.swift
//
// main.swift
// Swapper
//
// Created by Zev Eisenberg on 12/4/17.
// Copyright © 2017 Zev Eisenberg. All rights reserved.
//
// Code ported from https://www.reddit.com/r/juggling/comments/7839h0/find_number_of_beats_to_loop_a_given_siteswap/douuezu/
// It finds how many beats you would have to juggle an async siteswap pattern before
@ZevEisenberg
ZevEisenberg / Dictionary+Utilities.swift
Created Nov 29, 2017
Convert a dictionary’s keys from NSAttributedStringKey to String
View Dictionary+Utilities.swift
extension Dictionary where Key == NSAttributedStringKey {
var withStringKeys: [String: Value] {
return reduce(into: [:], {
$0[$1.key.rawValue] = $1.value
})
}
}
You can’t perform that action at this time.