Skip to content

Instantly share code, notes, and snippets.

View eddiekaiger's full-sized avatar

Eddie Kaiger eddiekaiger

View GitHub Profile
@eddiekaiger
eddiekaiger / AutoSizingCollectionViewCell.swift
Last active August 13, 2023 11:28
A cell class and collectionView layout that allows for dynamically sized cells
import Foundation
import UIKit
class AutoSizingCollectionViewCell: UICollectionViewCell {
override func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes {
layoutIfNeeded()
layoutAttributes.bounds.size.height = systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height
return layoutAttributes
}
}
@eddiekaiger
eddiekaiger / click.m
Last active April 30, 2024 15:19
Programmatically move/click mouse on macOS
// Found on: http://hints.macworld.com/article.php?story=2008051406323031
// File:
// click.m
//
// Compile with:
// gcc -o click click.m -framework ApplicationServices -framework Foundation
//
// Usage:
// ./click -x pixels -y pixels
@eddiekaiger
eddiekaiger / TypeComparable.swift
Last active October 4, 2016 01:52
TypeComparable
//
// TypeComparable
//
// Created by Eddie Kaiger on 10/3/16.
// Copyright (c) 2016 Eddie Kaiger. All rights reserved.
//
import Foundation
/**
@eddiekaiger
eddiekaiger / tweetie.json
Last active November 9, 2015 23:22
Tweets JSON
[
{
"postID": 10001,
"username": "eddiekaiger",
"content": "omg I love Swift and this is some really long tweet that should go over one line"
},
{
"postID": 10002,
"username": "ucdcsclub",
"content": "omg I love Swift"
@eddiekaiger
eddiekaiger / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@eddiekaiger
eddiekaiger / gist:24316e5e0481c898994e
Created December 2, 2014 22:55
Scroll-Based Animation in iOS
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
CGFloat scrollOffset = scrollView.contentOffset.y;
// Shift dismiss button up on scroll when user is at the top of the scrollview
if (scrollOffset < -[self tableViewOffsetTop]) {
self.dismissButton.transform = CGAffineTransformMakeTranslation(0, scrollOffset + [self tableViewOffsetTop]);
}
// Dismiss after user scrolls down far enough