Skip to content

Instantly share code, notes, and snippets.

@mattio
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! :)
@mattio
mattio / 1st Annual Fairfield County Beer Advent Calendar (2013)
Last active Dec 28, 2015
1st Annual Fairfield County Beer Advent Calendar (2013)
View 1st Annual Fairfield County Beer Advent Calendar (2013)
1st Annual Fairfield County Beer Advent Calendar (2013)
Sunday December 1:
De Struise, Svea IPA
http://beeradvocate.com/beer/profile/15237/66623
Monday December 2:
BrewDog, 5 A.M. Saint Red Ale
http://beeradvocate.com/beer/profile/16315/55191
Tuesday December 3:
Founders, Pale Ale
@mattio
mattio / MyConditionalTask.h
Created May 29, 2015
Conditional ORKOrderedTask
View MyConditionalTask.h
#import <ResearchKit/ResearchKit.h>
@interface MyConditionalTask : ORKOrderedTask <ORKTask>
@end
@mattio
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
http://www.apache.org/licenses/LICENSE-2.0
@mattio
mattio / App-re-signing.md
Last active Nov 18, 2020
Re-signing an .ipa file for iOS distribution
View App-re-signing.md

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
mattio / CleanAllSimulators.sh
Last active Oct 5, 2019
Shutdown and erase all Xcode simulators then re-open your default preference so it's ready to go.
View CleanAllSimulators.sh
#!/bin/bash
echo "Shutting down all devices..."
$(xcrun simctl shutdown all)
echo "Erasing all devices..."
$(xcrun simctl erase all)
echo "Quitting Simulator.app..."
$(osascript -e 'quit app "Simulator"')
View OIDExternalUserAgentIOSSafariViewController.h
// Original source from AppAuth: https://gist.github.com/WilliamDenniss/18f3779b4a310361bb955cf4e534f29c
// 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"
NS_ASSUME_NONNULL_BEGIN
@mattio
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"
@mattio
mattio / gist:f3fb7dfb8e1ad7901bb663ba577a157b
Created Apr 26, 2021 — forked from marcoarment/gist:1105553afba6b4900c10
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