Skip to content

Instantly share code, notes, and snippets.

@mattio
mattio / deadlock-queue.xqy
Created September 10, 2011 12:12
Deadlock with queue representation
(: 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 / MyConditionalTask.h
Created May 29, 2015 19:24
Conditional ORKOrderedTask
#import <ResearchKit/ResearchKit.h>
@interface MyConditionalTask : ORKOrderedTask <ORKTask>
@end
@mattio
mattio / CDVKeyboard.m
Created September 28, 2018 20:08
cordova-plugin-keyboard hack for iOS 12 shrink view
/*
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 January 17, 2024 07:39
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
mattio / CleanAllSimulators.sh
Last active October 5, 2019 13:13
Shutdown and erase all Xcode simulators then re-open your default preference so it's ready to go.
#!/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"')
// 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 July 19, 2020 12:43
A wee bit of JSON sample data for some practice exercises.
{
"players": [
{
"id": "girarjo01",
"firstName": "Joe",
"lastName": "Girardi",
"positions": ["C"],
"team": "NYY",
"bats": "R",
"throws": "R"
@mattio
mattio / gist:f3fb7dfb8e1ad7901bb663ba577a157b
Created April 26, 2021 12:20
Variable-height UITableView tableHeaderView with autolayout
// 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
mattio / FRP iOS Learning resources.md
Created October 27, 2021 01:33 — forked from JaviLorbada/FRP iOS Learning resources.md
The best FRP iOS resources.

Videos

@mattio
mattio / mikado-mermaid.md
Last active July 3, 2023 14:34
Simple Mikado Diagram using Mermaid

A simple Mikado diagram using Mermaid based on the example here: https://mikadomethod.info/index.html

flowchart BT

  Goal((("Encapsulate FileDB
  to be able to switch
  databases")))

 ReplaceInterface(("Replace FileDB