Skip to content

Instantly share code, notes, and snippets.

Avatar

Casey Liss cliss

View GitHub Profile
View MatchingHeightsPlaygroundPage.swift
import UIKit
import SwiftUI
import PlaygroundSupport
/* *****************************************
* GeometryReader with PreferenceKey
* *****************************************/
struct HeightPreferenceKey: PreferenceKey {
static let defaultValue: CGFloat = 0
@cliss
cliss / mergechapters.py
Created Jan 26, 2021
Merge Files with Chapters
View mergechapters.py
import datetime
import json
import os
import subprocess
import sys
#############
### USAGE ###
#############
View IndexPath+RawRepresentable.swift
import UIKit
public typealias RowSectionPair = (row: Int, section: Int)
extension IndexPath: RawRepresentable {
public typealias RawValue = RowSectionPair
public init?(rawValue: RowSectionPair) {
self = IndexPath(row: rawValue.row, section: rawValue.section)
}
@cliss
cliss / IteratorPlayground.swift
Created Dec 18, 2019
Playground contents showing the use of AnyIterator<T>
View IteratorPlayground.swift
import Foundation
class ListOfIntegers: Sequence {
typealias Element = Int
private var backingStore = [Int]()
init() {}
init(_ value: [Int]) {
self.backingStore = value
}
@cliss
cliss / Brewfile
Created Oct 8, 2019
Casey Liss's Brewfile, as of 8 October 2019
View Brewfile
cask_args appdir: "/Applications"
tap "homebrew/cask-fonts"
brew "mas"
mas "1Blocker", id: 1107421413
mas "Day One", id: 1055511498
mas "Deliveries", id: 924726344
mas "Due", id: 524373870
mas "Fantastical", id: 435003921
@cliss
cliss / SearchController.swift
Last active Jun 2, 2017 — forked from irace/SearchController.swift
UISearchController replacement. Relies on a couple of internal categories, helpers, etc.
View SearchController.swift
//
// SearchController.swift
// Prefer
//
// Created by Bryan Irace on 5/31/17.
// Copyright © 2017 Prefer. All rights reserved.
//
import RxSwift
import RxCocoa
View Top Gear Specials.txt
+--------+---------+-------------------------+
| Series | Episode | Description |
+--------+---------+-------------------------+
| 7 | 7 | Winter Olympics |
| 0 | 12 | Polar Challenge |
| 9 | 3 | Southeast America |
| 10 | 4 | Botswana |
| 12 | 8 | Vietnam |
| 14 | 6 | Bolivia |
| 0 | 33 | Northeast America |
@cliss
cliss / RxUIWebViewDelegateProxy.swift
Created Mar 29, 2016
Reactive Extensions for UIWebView
View RxUIWebViewDelegateProxy.swift
//
// RxUIWebViewDelegateProxy.swift
//
// Created by Casey Liss on 24/3/16.
// Copyright © 2016 Casey Liss. All rights reserved.
//
import Foundation
import RxSwift
import RxCocoa
@cliss
cliss / Playground.swift
Created Mar 16, 2016
Doing bad things with delegation
View Playground.swift
import UIKit
import CoreLocation
import XCPlayground
XCPlayground.XCPlaygroundPage.currentPage.needsIndefiniteExecution = true
class LocationDelegate: NSObject, CLLocationManagerDelegate {
override var description: String {
get {
return "LocationDelegate"
View DebugTimer.cs
public class DebugTimer : IDisposable
{
private readonly System.Diagnostics.Stopwatch _watch;
private readonly string _blockName;
/// <summary>
/// Creates a timer.
/// </summary>
/// <param name="blockName">Name of the block that's being timed</param>
public DebugTimer(string blockName)