Skip to content

Instantly share code, notes, and snippets.

View tomhamming's full-sized avatar

Tom Hamming tomhamming

  • Olive Tree Bible Software
View GitHub Profile
@steventroughtonsmith
steventroughtonsmith / V3DViewContainer.swift
Created February 2, 2024 17:14
UIKit proxy for visionOS 3D transforms and effects
//
// V3DViewContainer.swift
// Vision3DUIKit
//
// Created by Steven Troughton-Smith on 02/02/2024.
//
import UIKit
import SwiftUI
@chockenberry
chockenberry / Debug.swift
Last active April 11, 2024 13:22
Debug and release logging in Swift that's reminiscent of NSLog()
//
// Debug.swift
//
// Created by Craig Hockenberry on 3/15/17.
// Updated by Craig Hockenberry on 2/20/24.
// Usage:
//
// SplineReticulationManager.swift:
//
@corrieriluca
corrieriluca / App-Store-Connect-API-Python.md
Last active April 23, 2024 04:50
Connection to the App Store Connect API using Python3
@noahsark769
noahsark769 / UIImageView+ColorWheel.swift
Created February 27, 2019 16:47
Get the point on a color wheel image for a given color
extension UIImageView {
func pointOnColorWheel(for color: UIColor) -> CGPoint? {
guard let image = self.image else { return nil }
var hue: CGFloat = 0
var saturation: CGFloat = 0
var brightness: CGFloat = 0
color.getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: nil)
let width = self.frame.size.width
@smileyborg
smileyborg / InteractiveTransitionCollectionViewDeselection.m
Last active January 15, 2023 13:03
Animate table & collection view deselection alongside interactive transition (for iOS 11 and later)
// UICollectionView Objective-C example
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject];
if (selectedIndexPath != nil) {
id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator;
if (coordinator != nil) {
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
const long count = 10000000;
const char *str1 = "hellohello"; //fits in a tagged pointer
const char *str2 = "hellohelQo"; //at this character count, can only fit in a tagged pointer by using <8 bits per character, which requires dropping less frequently used chars like 'Q'
const char *str3 = "Northern Sami"; //this string is encountered frequently enough that it's baked into a perfect hash table in CoreFoundation
const char *str4 = "hellohellü"; //this string can't be tagged *and* can't be stored using an ASCII backing store
NSDate *start = [NSDate date];