Skip to content

Instantly share code, notes, and snippets.

View cliss's full-sized avatar

Casey Liss cliss

View GitHub Profile
@cliss
cliss / Brewfile
Last active April 12, 2024 01:38
Casey Liss's Brewfile, as of 31 October 2021
cask_args appdir: "/Applications"
tap "homebrew/cask-fonts"
brew "mas"
#### LAPTOPS ####
#cask "tripmode"
#### LAPTOPS ####
mas "Boop", id: 1518425043
@cliss
cliss / mergechapters.py
Created January 26, 2021 14:30
Merge Files with Chapters
import datetime
import json
import os
import subprocess
import sys
#############
### USAGE ###
#############
@cliss
cliss / Playground.swift
Last active May 12, 2023 14:18
List{} Gets Me Again
//: A UIKit based Playground for presenting user interface
import SwiftUI
import PlaygroundSupport
struct SlideDemo: View {
@State var activePage = 0
var body: some View {
// Change this VStack to a List and the animation breaks
@cliss
cliss / RxUIWebViewDelegateProxy.swift
Created March 29, 2016 13:48
Reactive Extensions for UIWebView
//
// 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 / Example.swift
Last active February 6, 2023 12:31
Decoding a heterogenous JSON array
// This is intended to be dropped in a Playground.
import Foundation
let json =
"""
{
"name": "Casey's Corner",
"menu": [
{
@cliss
cliss / organize-photos.py
Created October 6, 2013 14:43
Photo management script. This script will copy photos from "~/Pictures/iPhone Incoming" into a tree the script creates, with folders representing month and years, and photo names timestamped. Completely based on the work of the amazing Dr. Drang; see here: http://www.leancrew.com/all-this/2013/10/photo-management-via-the-finder/ You can see more…
#!/usr/bin/python
import sys
import os, shutil
import subprocess
import os.path
from datetime import datetime
######################## Functions #########################
@cliss
cliss / RatingsFetcher.swift
Created May 21, 2022 00:35
Fetching Ratings
import Foundation
import Combine
public struct RatingsFetcher {
/// Asynchronously gets the number of ratings for the current version of the given app.
/// - Parameter appId: App ID to look up
/// - Returns: Count of ratings for the current version
public static func ratingsForCurrentVersion(appId: Int) async throws -> Int {
guard let url = URL(string: "https://itunes.apple.com/lookup?id=\(appId)") else {
@cliss
cliss / MatchingHeightsPlaygroundPage.swift
Created February 2, 2021 14:39
Matching Heights Techniques
import UIKit
import SwiftUI
import PlaygroundSupport
/* *****************************************
* GeometryReader with PreferenceKey
* *****************************************/
struct HeightPreferenceKey: PreferenceKey {
static let defaultValue: CGFloat = 0
@cliss
cliss / DebugTimer.cs
Created February 2, 2015 19:07
C# Debug Timer
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)
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)
}