Skip to content

Instantly share code, notes, and snippets.

mattio / gist:f3fb7dfb8e1ad7901bb663ba577a157b
Created Apr 26, 2021
Variable-height UITableView tableHeaderView with autolayout
View gist:f3fb7dfb8e1ad7901bb663ba577a157b
// in a UITableViewController (or any other view controller with a UITableView)
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, size.width, 0)];
header.translatesAutoresizingMaskIntoConstraints = NO;
// [add subviews and their constraints to header]
NSLayoutConstraint *headerWidthConstraint = [NSLayoutConstraint
mattio / players.json
Last active Jul 19, 2020
A wee bit of JSON sample data for some practice exercises.
View players.json
"players": [
"id": "girarjo01",
"firstName": "Joe",
"lastName": "Girardi",
"positions": ["C"],
"team": "NYY",
"bats": "R",
"throws": "R"
View OIDExternalUserAgentIOSSafariViewController.h
// Original source from AppAuth:
// NOTE: If you use this for LOGIN, you probably want to use it for LOGOUT, too.
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <SafariServices/SafariServices.h>
#import "OIDExternalUserAgent.h"
mattio /
Last active Oct 5, 2019
Shutdown and erase all Xcode simulators then re-open your default preference so it's ready to go.
echo "Shutting down all devices..."
$(xcrun simctl shutdown all)
echo "Erasing all devices..."
$(xcrun simctl erase all)
echo "Quitting"
$(osascript -e 'quit app "Simulator"')
mattio /
Last active Jun 12, 2022
Re-signing an .ipa file for iOS distribution

Re-signing an .ipa file for iOS distribution

There are several apps I currently have to re-sign. They are apps built by various outside vendors who do not want to share the source code, but we want the apps published from our account and we do not want to give them our certificate or access to publish the apps on our behalf. ¯\_(ツ)_/¯ These are the steps I use to re-sign them. I've decided to keep the steps manual because, frankly, it's an error-prone process, something done infrequently, and a moving target. Some detail always seems to shift with every major Xcode release or App Store change.

These steps are current as of iOS 14 and Xcode 12. They assume you already have your Distribution Certificate installed in Keychain.

I'm going to use an example named "Matt's App.ipa". If you need to provide instructions to a vendor to deliver this file to you properly, I've included what I use below.

mattio / CDVKeyboard.m
Created Sep 28, 2018
cordova-plugin-keyboard hack for iOS 12 shrink view
View CDVKeyboard.m
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
mattio / MyConditionalTask.h
Created May 29, 2015
Conditional ORKOrderedTask
View MyConditionalTask.h
#import <ResearchKit/ResearchKit.h>
@interface MyConditionalTask : ORKOrderedTask <ORKTask>
mattio / deadlock-queue.xqy
Created Sep 10, 2011
Deadlock with queue representation
View deadlock-queue.xqy
(: The basic problem I'm trying to solve is that of a queue that can also updated
for priority overrides. I thought about using map:map, but this approach seemed
easier for a first cut. :)
(: If I call queue-lib:retrieve-queue() first, everything works fine. If I try to
call queue-lib:retrieve-queue() from within queue-lib:enqueue(), I'm creating
an update within an update condition, as I understand it, and I end up with a
deadlock condition. I haven't resolved this yet, so any suggestions are
welcome! :)