Skip to content

Instantly share code, notes, and snippets.

View thexande's full-sized avatar

Alexander Murphy thexande

  • Ibotta
  • Denver, CO, USA, Planet Earth
View GitHub Profile

Privacy Policy

Alexander Murphy built the Block Viewer app as a Free app. This SERVICE is provided by Alexander Murphy at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at Block Viewer unless otherwise defined in this Privacy Policy.

@thexande
thexande / vscodeCustom.css
Last active March 19, 2021 03:52
custom VS Code theme css
#workbench\2e parts\2e statusbar {
background: #673AB7;
background: -webkit-linear-gradient(to left, #673AB7, #00BCD4);
background: linear-gradient(to left, #673AB7, #00BCD4);
}
/*#workbench\2e parts\2e statusbar {
/*background: #f857a6;
background: -webkit-linear-gradient(to left, #f857a6, #ff5858);
background: linear-gradient(to left, #f857a6, #ff5858);
@thexande
thexande / Throttler.swift
Created February 19, 2019 18:06
throttle implementation class in swift
final class Throttler {
private var throttleWorkItems: [AnyHashable: DispatchWorkItem] = [:]
private var lastDebounceCallTimes: [AnyHashable: DispatchTime] = [:]
private let nilContext: AnyHashable = arc4random()
/// Delays a closure execution and ensures no other executions are made during deadline
///
/// - Parameters:
/// - deadline: The timespan to delay a closure execution
@thexande
thexande / interactive_transitions.md
Created December 5, 2020 03:33
A writeup on interactive transitions in UIKit.

Leveraging Interactive Custom View Controller Transitions

At Ibotta, we're constantly striving to provide our savers with the best possible user experience. As an iOS engineer, there are a number of super powerful APIs at my disposal to provide a top noch mobile UX.

One such API is the custom view controller transitioning capabilities contained within UIKit. These protocols provide an interface to control how one view controller is presented over another, and level of customization available to the programmer is significant.

Let's consider the basic use case of a card modal presentation. When a user selects an item on one view, another detail view is presented over the top. The presented detail view can then be dismissed by swiping down. This downward swipe is generally interactive, meaning the view follows the movement of your thumb as you swipe to dismiss.

This pattern is quite common across iOS applications, especially apps which have payment capabilities. With Ibotta's entrance into the payments

@thexande
thexande / MatchedGeometryEffectDemo.swift
Created July 11, 2020 00:23
A playground showing how the .matchedGeometryEffect modifier works.
import SwiftUI
import PlaygroundSupport
final class Item: Identifiable {
let color: Color
let id = UUID()
var displayDetail: Bool
init(color: Color, displayDetail: Bool = false) {
self.color = color
self.displayDetail = displayDetail
@thexande
thexande / GeometryReaderBugInLazyVStack.swift
Created July 11, 2020 19:39
A Swift UI playground displaying a bug when using geometry reader in lazy v grid.
import SwiftUI
import PlaygroundSupport
let ipsum = "Lorem Ipsum is simply dummy text of the printing and typesetting industry."
extension CGFloat {
static var random: CGFloat {
return CGFloat(arc4random()) / CGFloat(UInt32.max)
}
}
private func executeShellCommand(_ command: String) {
let task = Process()
let pipe = Pipe()
task.standardOutput = pipe
task.arguments = ["-c", command]
task.launchPath = "/bin/bash"
// task.launch()
let outputHandle = pipe.fileHandleForReading
@thexande
thexande / CoffeeMachine.swift
Created April 10, 2020 22:15
A coffee machine implementation using swift.
protocol ResourcesContaining {
var beans: Double { get set }
var milk: Double { get set }
var water: Double { get set }
func hasRequiredResources(for resourceSet: [Resource]) -> Bool
}
extension ResourcesContaining {
func hasRequiredResources(for resourceSet: [Resource]) -> Bool {
var currentBeans = self.beans
enum Node<T> where T: Equatable & Comparable {
case empty
indirect case value(left: Node<T>, value: T, right: Node<T>)
}
extension Node {
func isValid(within range: ClosedRange<T>) -> Bool {
switch self {
case .empty:
return true
@thexande
thexande / Valid Binary Search Tree.swift
Last active January 22, 2020 05:15
Determine if a given binary search tree is valid.
final class Node {
let left: Node?
let right: Node?
let value: Int
init(left: Node? = nil, right: Node? = nil, value: Int) {
self.left = left
self.right = right
self.value = value
}