Skip to content

Instantly share code, notes, and snippets.

View chrismaddern's full-sized avatar

Chris Maddern chrismaddern

View GitHub Profile
@chrismaddern
chrismaddern / erc1155-abi.json
Created February 21, 2022 17:10
Base ABI for ERC 1155 contract
{
"abi":[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "_owner",
"type": "address"
@chrismaddern
chrismaddern / erc721-abi.json
Created February 21, 2022 17:07
Base ABI for an ERC721 contract.
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "_name",
"type": "string"
}
@chrismaddern
chrismaddern / re-sign-ios-app.sh
Last active May 23, 2022 21:25
Re-sign an iOS App with your own Certificate & Provisioning Profile
# Script assumes it's running in a folder with all these files
IPA="ipa_to_resign.ipa"
PROVISION="my_enterprise_provision_profile.mobileprovision"
CERTIFICATE="iPhone Distribution: My Organization, Inc." # must be in keychain
# Unzip the IPA & delete existing codesigning
unzip -q "$IPA"
rm -rf Payload/*.app/_CodeSignature Payload/*.app/CodeResources
# Copy the new Provision Profile
let array = ["@xwordy", "@elfederiko", "@chelseaheathh", "@jairo_avalos", "@JoshRamos0818", "@VeryBadHello" ]
let randomIndex = Int(arc4random_uniform(UInt32(array.count)))
print(array[randomIndex])
@chrismaddern
chrismaddern / Storyboard Reduction
Created September 28, 2014 23:26
Storyboard Reduction
<view key="view">
<subviews>
<mapView mapType="standard" showsUserLocation="YES" showsBuildings="NO" />
<button opaque="NO" contentMode="scaleAspectFill">
<rect key="frame" x="10" y="30" width="40" height="40"/>
</button>
<view clipsSubviews="YES" contentMode="scaleToFill">
<rect key="frame" x="0.0" y="414" width="320" height="100"/>
<subviews>
<collectionView opaque="NO">
@chrismaddern
chrismaddern / Storyboard Fragment
Created September 28, 2014 23:18
Clips from my post on web vs. native
<view key="view" contentMode="scaleToFill" id="SHh-SP-yVu">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<mapView mapType="standard" showsUserLocation="YES" showsBuildings="NO" id="UIZ-1B-l3e">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
</mapView>
<button opaque="NO" contentMode="scaleAspectFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="233-h5-Yuj">
<rect key="frame" x="10" y="30" width="40" height="40"/>
<constraints>
@chrismaddern
chrismaddern / bluetooth-enabled.m
Last active March 2, 2019 18:48
Determine whether bluetooth is enabled on iOS
- (void)startBluetoothStatusMonitoring {
// Horrible formatting, but nicer for blog-width!
self.bluetoothManager = [[CBCentralManager alloc]
initWithDelegate:self
queue:dispatch_get_main_queue()
options:@{CBCentralManagerOptionShowPowerAlertKey: @(NO)}];
}
#pragma mark - CBCentralManagerDelegate
@chrismaddern
chrismaddern / bots_setup_step.sh
Last active August 29, 2015 13:57
Xcode Bots Blog Post
if [ "$USER" == "_teamsserver" ]; then
echo "Running PreBotsStep"
cd $SRCROOT/../
./setup --not-interactive
cd $SRCROOT
else
echo "Username: $USERNAME"
echo "Not on Bots Server, skipping PreBotsStep"
fi
@chrismaddern
chrismaddern / gist:7950022
Last active December 31, 2015 06:49
Playing around with what the interface could look like for potential XPC (3rd party remote view controllers) features in iOS 8
/*
Assume that remote view controllers are instantiable inside of any application.
Give developers a header to give the instantiated VC an interface and be able to compile etc..
*/
#import "VENNewTransactionViewControllerXPCStub.h" // Give developers this header to give the transaction view controller an interface
...
// Assume a concrete class is available and instantiate it
if (NSClassFromString(@"VENNewTransactionViewController") {
VENNewTransactionViewController *newTransactionController = [[VENNewTransactionViewController alloc] init];
}